[Bf-blender-cvs] [b8e0b2d] master: Math Lib: isect_plane_*_v3 avoid negation

Campbell Barton noreply at git.blender.org
Sat Sep 5 09:50:13 CEST 2015


Commit: b8e0b2db56b1a6e5dc85640939b8664b2304a01f
Author: Campbell Barton
Date:   Sat Sep 5 17:42:31 2015 +1000
Branches: master
https://developer.blender.org/rBb8e0b2db56b1a6e5dc85640939b8664b2304a01f

Math Lib: isect_plane_*_v3 avoid negation

Unmeasurable speedup for plane intersection.

===================================================================

M	source/blender/blenlib/intern/math_geom.c

===================================================================

diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 72ae959..dad2a2f 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -1577,14 +1577,14 @@ bool isect_plane_plane_plane_v3(
 		 *  plane_c.xyz.cross(plane_a.xyz) * -plane_b[3] +
 		 *  plane_a.xyz.cross(plane_b.xyz) * -plane_c[3]) / det; */
 
-		cross_v3_v3v3(tmp, plane_b, plane_c);
-		mul_v3_v3fl(r_isect_co, tmp, -plane_a[3]);
+		cross_v3_v3v3(tmp, plane_c, plane_b);
+		mul_v3_v3fl(r_isect_co, tmp, plane_a[3]);
 
-		cross_v3_v3v3(tmp, plane_c, plane_a);
-		madd_v3_v3fl(r_isect_co, tmp, -plane_b[3]);
+		cross_v3_v3v3(tmp, plane_a, plane_c);
+		madd_v3_v3fl(r_isect_co, tmp, plane_b[3]);
 
-		cross_v3_v3v3(tmp, plane_a, plane_b);
-		madd_v3_v3fl(r_isect_co, tmp, -plane_c[3]);
+		cross_v3_v3v3(tmp, plane_b, plane_a);
+		madd_v3_v3fl(r_isect_co, tmp, plane_c[3]);
 
 		mul_v3_fl(r_isect_co, 1.0f / det);
 
@@ -1625,11 +1625,11 @@ bool isect_plane_plane_v3(
 
 		/* (plane_b.xyz.cross(plane_c.xyz) * -plane_a[3] +
 		 *  plane_c.xyz.cross(plane_a.xyz) * -plane_b[3]) / det; */
-		cross_v3_v3v3(tmp, plane_b, plane_c);
-		mul_v3_v3fl(r_isect_co, tmp, -plane_a[3]);
+		cross_v3_v3v3(tmp, plane_c, plane_b);
+		mul_v3_v3fl(r_isect_co, tmp, plane_a[3]);
 
-		cross_v3_v3v3(tmp, plane_c, plane_a);
-		madd_v3_v3fl(r_isect_co, tmp, -plane_b[3]);
+		cross_v3_v3v3(tmp, plane_a, plane_c);
+		madd_v3_v3fl(r_isect_co, tmp, plane_b[3]);
 
 		mul_v3_fl(r_isect_co, 1.0f / det);




More information about the Bf-blender-cvs mailing list