diff --git a/src/libtess2/Source/sweep.c b/src/libtess2/Source/sweep.c index 112f1ef5..6a927745 100755 --- a/src/libtess2/Source/sweep.c +++ b/src/libtess2/Source/sweep.c @@ -1122,11 +1122,12 @@ static void InitEdgeDict( TESStesselator *tess ) h = (tess->bmax[1] - tess->bmin[1]); /* 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); + slightly enlarging it. To avoid floating point precision issues, + make sure to enlarge by a minimal amount. */ + smin = tess->bmin[0] - (w > 0.01 ? w : 0.01); + smax = tess->bmax[0] + (w > 0.01 ? w : 0.01); + tmin = tess->bmin[1] - (h > 0.01 ? h : 0.01); + tmax = tess->bmax[1] + (h > 0.01 ? h : 0.01); AddSentinel( tess, smin, smax, tmin ); AddSentinel( tess, smin, smax, tmax );