diff --git a/src/libtess2/Source/sweep.c b/src/libtess2/Source/sweep.c index 73da9353..a8d8971a 100755 --- a/src/libtess2/Source/sweep.c +++ b/src/libtess2/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 ); diff --git a/src/libtess2/Source/tess.c b/src/libtess2/Source/tess.c index fa1639c3..ff8039ed 100755 --- a/src/libtess2/Source/tess.c +++ b/src/libtess2/Source/tess.c @@ -70,6 +70,15 @@ static int LongAxis( TESSreal v[3] ) return i; } +static int ShortAxis( TESSreal v[3] ) +{ + int i = 0; + + if( ABS(v[1]) < ABS(v[0]) ) { i = 1; } + if( ABS(v[2]) < ABS(v[i]) ) { i = 2; } + return i; +} + static void ComputeNormal( TESStesselator *tess, TESSreal norm[3] ) { TESSvertex *v, *v1, *v2; @@ -136,7 +145,7 @@ static void ComputeNormal( TESStesselator *tess, TESSreal norm[3] ) if( maxLen2 <= 0 ) { /* All points lie on a single line -- any decent normal will do */ norm[0] = norm[1] = norm[2] = 0; - norm[LongAxis(d1)] = 1; + norm[ShortAxis(d1)] = 1; } }