diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-01-13 11:01:40 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-01-13 11:10:15 +0300 |
commit | 3debcc8b517ece352aa325cfd61adc0b16cf91da (patch) | |
tree | 2a490701226a73493c8d73e3a6ceeb3efe2e908b /source/blender/blenlib/intern/math_geom_inline.c | |
parent | 00ef77c1a241aaf3d7c6307411e97938b87c3096 (diff) |
Math Lib: improve area calculation
- area_quad_v3 now works correctly with concave quads.
- add area_squared_*** functions, to use when comparing to avoid a sqrt().
Diffstat (limited to 'source/blender/blenlib/intern/math_geom_inline.c')
-rw-r--r-- | source/blender/blenlib/intern/math_geom_inline.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_geom_inline.c b/source/blender/blenlib/intern/math_geom_inline.c index 5a64ed63ecf..44b17681540 100644 --- a/source/blender/blenlib/intern/math_geom_inline.c +++ b/source/blender/blenlib/intern/math_geom_inline.c @@ -54,6 +54,12 @@ 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)); } +MINLINE float area_squared_tri_v2(const float v1[2], const float v2[2], const float v3[2]) +{ + float area = area_tri_signed_v2(v1, v2, v3); + return area * area; +} + /****************************** Spherical Harmonics **************************/ MINLINE void zero_sh(float r[9]) |