[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58379] trunk/blender/source/blender/ blenlib/intern/math_geom.c: code cleanup: avoid sqrt in isect_seg_seg_v2_point
Campbell Barton
ideasman42 at gmail.com
Fri Jul 19 12:39:37 CEST 2013
Revision: 58379
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58379
Author: campbellbarton
Date: 2013-07-19 10:39:37 +0000 (Fri, 19 Jul 2013)
Log Message:
-----------
code cleanup: avoid sqrt in isect_seg_seg_v2_point
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-07-19 10:39:32 UTC (rev 58378)
+++ trunk/blender/source/blender/blenlib/intern/math_geom.c 2013-07-19 10:39:37 UTC (rev 58379)
@@ -494,6 +494,7 @@
float a1, a2, b1, b2, c1, c2, d;
float u, v;
const float eps = 0.000001f;
+ const float eps_sq = eps * eps;
a1 = v2[0] - v1[0];
b1 = v4[0] - v3[0];
@@ -510,8 +511,8 @@
float a[2], b[2], c[2];
float u2;
- if (len_v2v2(v1, v2) == 0.0f) {
- if (len_v2v2(v3, v4) > eps) {
+ if (equals_v2v2(v1, v2)) {
+ if (len_squared_v2v2(v3, v4) > eps_sq) {
/* use non-point segment as basis */
SWAP(const float *, v1, v3);
SWAP(const float *, v2, v4);
More information about the Bf-blender-cvs
mailing list