diff options
author | Sergej Reich <sergej.reich@googlemail.com> | 2013-03-07 23:16:02 +0400 |
---|---|---|
committer | Sergej Reich <sergej.reich@googlemail.com> | 2013-03-07 23:16:02 +0400 |
commit | 8db7a34167f6a5573c547b13fb25c735fd1cdcb6 (patch) | |
tree | d83faca426162f00dcebe7992fce7857660003d2 /source/blender/blenlib | |
parent | 8e474517db366f6f88d99b1b83f615f3320b71bd (diff) |
math: Use len_v3() instead of normalize_v3() for area calculation
We only need the length, avoids unnecessary calculations.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 8f7ecdcfde8..e542712b3b2 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -106,12 +106,12 @@ float area_quad_v3(const float v1[3], const float v2[3], const float v3[3], cons sub_v3_v3v3(vec1, v2, v1); sub_v3_v3v3(vec2, v4, v1); cross_v3_v3v3(n, vec1, vec2); - len = normalize_v3(n); + len = len_v3(n); sub_v3_v3v3(vec1, v4, v3); sub_v3_v3v3(vec2, v2, v3); cross_v3_v3v3(n, vec1, vec2); - len += normalize_v3(n); + len += len_v3(n); return (len / 2.0f); } @@ -119,14 +119,13 @@ float area_quad_v3(const float v1[3], const float v2[3], const float v3[3], cons /* Triangles */ float area_tri_v3(const float v1[3], const float v2[3], const float v3[3]) { - float len, vec1[3], vec2[3], n[3]; + float vec1[3], vec2[3], n[3]; sub_v3_v3v3(vec1, v3, v2); sub_v3_v3v3(vec2, v1, v2); cross_v3_v3v3(n, vec1, vec2); - len = normalize_v3(n); - return (len / 2.0f); + return len_v3(n) / 2.0f; } float area_tri_signed_v3(const float v1[3], const float v2[3], const float v3[3], const float normal[3]) |