Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-07-05 22:03:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-05 22:03:07 +0400
commit5f3bd06f37d13d486ea6a8540b9d7f9cd50f39b7 (patch)
tree41ad97934c57a5502f003cddf4e7b693db011b51 /source/blender/bmesh
parentd8b86fd9b2365b070df9c0de0d3dc14b62d91a63 (diff)
code cleanup: use a define for bmesh hull epsilon
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/operators/bmo_hull.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c
index 1bd2f41209b..82ab49b5c38 100644
--- a/source/blender/bmesh/operators/bmo_hull.c
+++ b/source/blender/bmesh/operators/bmo_hull.c
@@ -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 @@ static int hull_point_tri_side(const HullTriangle *t, const float co[3])
/* 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 @@ static int hull_find_large_tetrahedron(BMesh *bm, BMOperator *op,
}
/* 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 @@ static int hull_find_large_tetrahedron(BMesh *bm, BMOperator *op,
return TRUE;
}
- if (largest_dist < 0.0001f)
+ if (largest_dist < HULL_EPSILON_FLT)
return TRUE;
return FALSE;