Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'object_print3d_utils/mesh_helpers.py')
-rw-r--r--object_print3d_utils/mesh_helpers.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/object_print3d_utils/mesh_helpers.py b/object_print3d_utils/mesh_helpers.py
index a9bd3c75..faf16d2e 100644
--- a/object_print3d_utils/mesh_helpers.py
+++ b/object_print3d_utils/mesh_helpers.py
@@ -98,6 +98,16 @@ def bmesh_calc_volume(bm):
for f in bm.faces)))
+def bmesh_calc_volume_signed(bm):
+ """
+ Calculate the volume of a triangulated bmesh.
+ """
+ def tri_signed_volume(p1, p2, p3):
+ return p1.dot(p2.cross(p3)) / 6.0
+ return sum((tri_signed_volume(*(v.co for v in f.verts))
+ for f in bm.faces))
+
+
def bmesh_calc_area(bm):
"""
Calculate the surface area.