Don't duplicate points when connecting contours with zero length bridge. Fixes #303
This commit is contained in:
parent
04b332dfd0
commit
bc4924ae47
@ -109,6 +109,7 @@ bool SContour::BridgeToContour(SContour *sc,
|
|||||||
SEdgeList *avoidEdges, List<Vector> *avoidPts)
|
SEdgeList *avoidEdges, List<Vector> *avoidPts)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
bool withbridge = true;
|
||||||
|
|
||||||
// Start looking for a bridge on our new hole near its leftmost (min x)
|
// Start looking for a bridge on our new hole near its leftmost (min x)
|
||||||
// point.
|
// point.
|
||||||
@ -152,6 +153,7 @@ bool SContour::BridgeToContour(SContour *sc,
|
|||||||
b = sc->l[scp].p;
|
b = sc->l[scp].p;
|
||||||
|
|
||||||
if(a.Equals(b)) {
|
if(a.Equals(b)) {
|
||||||
|
withbridge = false;
|
||||||
goto haveEdge;
|
goto haveEdge;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,7 +192,9 @@ bool SContour::BridgeToContour(SContour *sc,
|
|||||||
haveEdge:
|
haveEdge:
|
||||||
SContour merged = {};
|
SContour merged = {};
|
||||||
for(i = 0; i < l.n; i++) {
|
for(i = 0; i < l.n; i++) {
|
||||||
merged.AddPoint(l[i].p);
|
if(withbridge || (i != thisp)) {
|
||||||
|
merged.AddPoint(l[i].p);
|
||||||
|
}
|
||||||
if(i == thisp) {
|
if(i == thisp) {
|
||||||
// less than or equal; need to duplicate the join point
|
// less than or equal; need to duplicate the join point
|
||||||
for(j = 0; j <= (sc->l.n - 1); j++) {
|
for(j = 0; j <= (sc->l.n - 1); j++) {
|
||||||
@ -198,7 +202,9 @@ haveEdge:
|
|||||||
merged.AddPoint((sc->l[jp]).p);
|
merged.AddPoint((sc->l[jp]).p);
|
||||||
}
|
}
|
||||||
// and likewise duplicate join point for the outer curve
|
// and likewise duplicate join point for the outer curve
|
||||||
merged.AddPoint(l[i].p);
|
if(withbridge) {
|
||||||
|
merged.AddPoint(l[i].p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user