[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48658] trunk/blender/source/blender/bmesh /operators/bmo_hull.c: code cleanup: use a define for bmesh hull epsilon

Campbell Barton ideasman42 at gmail.com
Thu Jul 5 20:03:07 CEST 2012


Revision: 48658
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48658
Author:   campbellbarton
Date:     2012-07-05 18:03:07 +0000 (Thu, 05 Jul 2012)
Log Message:
-----------
code cleanup: use a define for bmesh hull epsilon

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/operators/bmo_hull.c

Modified: trunk/blender/source/blender/bmesh/operators/bmo_hull.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_hull.c	2012-07-05 18:02:28 UTC (rev 48657)
+++ trunk/blender/source/blender/bmesh/operators/bmo_hull.c	2012-07-05 18:03:07 UTC (rev 48658)
@@ -37,6 +37,8 @@
 
 #include "bmesh.h"
 
+#define HULL_EPSILON_FLT 0.0001f
+
 /* Internal operator flags */
 typedef enum {
 	HULL_FLAG_INPUT =           (1 << 0),
@@ -143,11 +145,11 @@
 	/* Added epsilon to fix bug [#31941], improves output when some
 	 * vertices are nearly coplanar. Might need further tweaking for
 	 * other cases though. */
-	float p[3], d, epsilon = 0.0001;
+	float p[3], d;
 	sub_v3_v3v3(p, co, t->v[0]->co);
 	d = dot_v3v3(t->no, p);
-	if (d < -epsilon) return -1;
-	else if (d > epsilon) return 1;
+	if      (d < -HULL_EPSILON_FLT) return -1;
+	else if (d >  HULL_EPSILON_FLT) return  1;
 	else return 0;
 }
 
@@ -464,7 +466,7 @@
 	}
 
 	/* Check for colinear vertices */
-	if (largest_dist < 0.0001f)
+	if (largest_dist < HULL_EPSILON_FLT)
 		return TRUE;
 
 	/* Choose fourth point farthest from existing plane */
@@ -487,7 +489,7 @@
 		return TRUE;
 	}
 
-	if (largest_dist < 0.0001f)
+	if (largest_dist < HULL_EPSILON_FLT)
 		return TRUE;
 
 	return FALSE;




More information about the Bf-blender-cvs mailing list