Merge pull request #10 from openscad/sentinel-workaround
Sentinel workaround, should fix #8
diff --git a/Source/sweep.c b/Source/sweep.c
index 73da935..112f1ef 100755
--- a/Source/sweep.c
+++ b/Source/sweep.c
@@ -1121,10 +1121,12 @@
w = (tess->bmax[0] - tess->bmin[0]);
h = (tess->bmax[1] - tess->bmin[1]);
- smin = tess->bmin[0] - w;
- smax = tess->bmax[0] + w;
- tmin = tess->bmin[1] - h;
- tmax = tess->bmax[1] + h;
+ /* If the bbox is empty, ensure that sentinels are not coincident by
+ slightly enlarging it. */
+ smin = tess->bmin[0] - (w > 0 ? w : 0.01);
+ smax = tess->bmax[0] + (w > 0 ? w : 0.01);
+ tmin = tess->bmin[1] - (h > 0 ? h : 0.01);
+ tmax = tess->bmax[1] + (h > 0 ? h : 0.01);
AddSentinel( tess, smin, smax, tmin );
AddSentinel( tess, smin, smax, tmax );