From b8e0b2db56b1a6e5dc85640939b8664b2304a01f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 5 Sep 2015 17:42:31 +1000 Subject: Math Lib: isect_plane_*_v3 avoid negation Unmeasurable speedup for plane intersection. --- source/blender/blenlib/intern/math_geom.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 72ae9597777..dad2a2fc288 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); -- cgit v1.2.3