From b256f4940bbd8ddb12534ce0e1751d7cb67c84d9 Mon Sep 17 00:00:00 2001 From: Mikko Mononen Date: Mon, 16 Apr 2018 11:52:47 +0300 Subject: [PATCH] Fix for #14 - always pad sentinels --- Source/sweep.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Source/sweep.c b/Source/sweep.c index 4f3c53e..32a56bf 100755 --- a/Source/sweep.c +++ b/Source/sweep.c @@ -1118,15 +1118,14 @@ static void InitEdgeDict( TESStesselator *tess ) tess->dict = dictNewDict( &tess->alloc, tess, (int (*)(void *, DictKey, DictKey)) EdgeLeq ); if (tess->dict == NULL) longjmp(tess->env,1); - w = (tess->bmax[0] - tess->bmin[0]); - h = (tess->bmax[1] - tess->bmin[1]); + /* If the bbox is empty, ensure that sentinels are not coincident by slightly enlarging it. */ + w = (tess->bmax[0] - tess->bmin[0]) + (TESSreal)0.01; + h = (tess->bmax[1] - tess->bmin[1]) + (TESSreal)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); + smin = tess->bmin[0] - w; + smax = tess->bmax[0] + w; + tmin = tess->bmin[1] - h; + tmax = tess->bmax[1] + h; AddSentinel( tess, smin, smax, tmin ); AddSentinel( tess, smin, smax, tmax );