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_inline.c')
-rw-r--r--source/blender/blenlib/intern/math_geom_inline.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/math_geom_inline.c b/source/blender/blenlib/intern/math_geom_inline.c
index ac5c0033067..a5906dbdf6c 100644
--- a/source/blender/blenlib/intern/math_geom_inline.c
+++ b/source/blender/blenlib/intern/math_geom_inline.c
@@ -34,6 +34,23 @@
#include <string.h>
+/********************************** Polygons *********************************/
+
+MINLINE float cross_tri_v2(const float v1[2], const float v2[2], const float v3[2])
+{
+ return (v1[0] - v2[0]) * (v2[1] - v3[1]) + (v1[1] - v2[1]) * (v3[0] - v2[0]);
+}
+
+MINLINE float area_tri_signed_v2(const float v1[2], const float v2[2], const float v3[2])
+{
+ return 0.5f * ((v1[0] - v2[0]) * (v2[1] - v3[1]) + (v1[1] - v2[1]) * (v3[0] - v2[0]));
+}
+
+MINLINE float area_tri_v2(const float v1[2], const float v2[2], const float v3[2])
+{
+ return fabsf(area_tri_signed_v2(v1, v2, v3));
+}
+
/****************************** Spherical Harmonics **************************/
MINLINE void zero_sh(float r[9])
@@ -62,7 +79,7 @@ MINLINE void add_sh_shsh(float r[9], const float a[9], const float b[9])
r[i] = a[i] + b[i];
}
-MINLINE float dot_shsh(float a[9], float b[9])
+MINLINE float dot_shsh(const float a[9], const float b[9])
{
float r = 0.0f;
int i;