diff options
author | Alexander Pinzon Fernandez <apinzonf@gmail.com> | 2013-12-11 20:10:22 +0400 |
---|---|---|
committer | Alexander Pinzon Fernandez <apinzonf@gmail.com> | 2013-12-11 20:10:22 +0400 |
commit | 2658a3c1b44717f497f187a38000c804eb37bbba (patch) | |
tree | ee55c673feabced8b6ec8bf9a8aa4d82a3cda3db /source/blender/blenlib/intern/math_geom_inline.c | |
parent | 4005cb1c6a63a217df0e887c741beee2c1359301 (diff) | |
parent | 09b859d03f0ee138c4273ef8460e91d9888387a1 (diff) |
Merge branch 'master' into soc-2013-sketch_meshsoc-2013-sketch_mesh
Conflicts:
release/scripts/addons
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/object/object_modifier.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/modifiers/intern/MOD_laplaciandeform.c
Diffstat (limited to 'source/blender/blenlib/intern/math_geom_inline.c')
-rw-r--r-- | source/blender/blenlib/intern/math_geom_inline.c | 19 |
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; |