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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/intern/math_geom.c')
-rw-r--r--source/blender/blenlib/intern/math_geom.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 5f3ab5eb73e..efb881cde1b 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -238,6 +238,18 @@ float volume_tetrahedron_v3(const float v1[3], const float v2[3], const float v3
return fabsf(determinant_m3_array(m)) / 6.0f;
}
+/**
+ * The volume from a tetrahedron, normal pointing inside gives negative volume
+ */
+float volume_tetrahedron_signed_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3])
+{
+ float m[3][3];
+ sub_v3_v3v3(m[0], v1, v2);
+ sub_v3_v3v3(m[1], v2, v3);
+ sub_v3_v3v3(m[2], v3, v4);
+ return determinant_m3_array(m) / 6.0f;
+}
+
/********************************* Distance **********************************/