[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55098] trunk/blender/source/blender/ blenlib/intern/math_geom.c: math: Use len_v3() instead of normalize_v3() for area calculation
Sergej Reich
sergej.reich at googlemail.com
Thu Mar 7 20:16:02 CET 2013
Revision: 55098
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55098
Author: sergof
Date: 2013-03-07 19:16:02 +0000 (Thu, 07 Mar 2013)
Log Message:
-----------
math: Use len_v3() instead of normalize_v3() for area calculation
We only need the length, avoids unnecessary calculations.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/math_geom.c
Modified: trunk/blender/source/blender/blenlib/intern/math_geom.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_geom.c 2013-03-07 18:01:10 UTC (rev 55097)
+++ trunk/blender/source/blender/blenlib/intern/math_geom.c 2013-03-07 19:16:02 UTC (rev 55098)
@@ -106,12 +106,12 @@
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 @@
/* 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])
More information about the Bf-blender-cvs
mailing list