From 7e004ebdedcd0fc93ec01603d9ec941a949c7d5f Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 13 Jan 2015 16:35:56 -0500 Subject: [PATCH 1/2] Workaround for issue #8; make sure sentinels are not coincident --- Source/sweep.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/sweep.c b/Source/sweep.c index 73da935..a8d8971 100755 --- a/Source/sweep.c +++ b/Source/sweep.c @@ -1121,10 +1121,10 @@ static void InitEdgeDict( TESStesselator *tess ) 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; + smin = tess->bmin[0] - w - 0.01; + smax = tess->bmax[0] + w + 0.01; + tmin = tess->bmin[1] - h - 0.01; + tmax = tess->bmax[1] + h + 0.01; AddSentinel( tess, smin, smax, tmin ); AddSentinel( tess, smin, smax, tmax ); From d7c34ac3ff11993b0fc0395fe7d96f4cc75e6bb6 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 13 Jan 2015 18:03:58 -0500 Subject: [PATCH 2/2] Clarify the sentinel workaround --- Source/sweep.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/sweep.c b/Source/sweep.c index a8d8971..112f1ef 100755 --- a/Source/sweep.c +++ b/Source/sweep.c @@ -1121,10 +1121,12 @@ static void InitEdgeDict( TESStesselator *tess ) w = (tess->bmax[0] - tess->bmin[0]); h = (tess->bmax[1] - tess->bmin[1]); - smin = tess->bmin[0] - w - 0.01; - smax = tess->bmax[0] + w + 0.01; - tmin = tess->bmin[1] - h - 0.01; - tmax = tess->bmax[1] + h + 0.01; + /* 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 );