diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-07 00:16:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-07 00:16:04 +0400 |
commit | 2336aadb80f8602f001b2c5b0bcaacf3ad858f83 (patch) | |
tree | c2f3cc7d8eaac1fa993c20296ab26c3b17d02c15 | |
parent | 1a9e7a00f3d11c6c0eed955c7cd45adca9522111 (diff) |
decrease size for convex hull epsilon when checking which side of a face the vertex is on.
this doesnt fix all cases but works better then it did.
-rw-r--r-- | source/blender/bmesh/operators/bmo_hull.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c index f94683c3bc1..d4f63ab7557 100644 --- a/source/blender/bmesh/operators/bmo_hull.c +++ b/source/blender/bmesh/operators/bmo_hull.c @@ -38,6 +38,9 @@ #include "bmesh.h" #define HULL_EPSILON_FLT 0.0001f +/* values above 0.0001 cause errors, see below for details, don't increase + * without checking against bug [#32027] */ +#define HULL_EPSILON_DOT_FLT 0.00000001f /* Internal operator flags */ typedef enum { @@ -144,12 +147,16 @@ 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. */ + * other cases though. + * ... + * Update: epsilon of 0.0001 causes [#32027], use HULL_EPSILON_DOT_FLT + * and give it a much smaller value + * */ float p[3], d; sub_v3_v3v3(p, co, t->v[0]->co); d = dot_v3v3(t->no, p); - if (d < -HULL_EPSILON_FLT) return -1; - else if (d > HULL_EPSILON_FLT) return 1; + if (d < -HULL_EPSILON_DOT_FLT) return -1; + else if (d > HULL_EPSILON_DOT_FLT) return 1; else return 0; } |