From c50d927216f56a227cfccb1b1bd6d5f44041a005 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Mon, 9 Feb 2015 18:42:17 -0500 Subject: [PATCH] Fixed bug in libtess. Fixes #1210 --- src/libtess2/Source/sweep.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 );