Less work in AssembleContour

This commit is contained in:
phkahler 2020-05-06 17:27:31 -04:00
parent 88a0e55f35
commit a52d88bc3d
2 changed files with 4 additions and 4 deletions

View File

@ -224,7 +224,7 @@ void SEdgeList::AddEdge(Vector a, Vector b, int auxA, int auxB, int tag) {
}
bool SEdgeList::AssembleContour(Vector first, Vector last, SContour *dest,
SEdge *errorAt, bool keepDir) const
SEdge *errorAt, bool keepDir, int start) const
{
int i;
@ -232,7 +232,7 @@ bool SEdgeList::AssembleContour(Vector first, Vector last, SContour *dest,
dest->AddPoint(last);
do {
for(i = 0; i < l.n; i++) {
for(i = start; i < l.n; i++) {
/// @todo fix const!
SEdge *se = const_cast<SEdge*>(&(l[i]));
if(se->tag) continue;
@ -281,7 +281,7 @@ bool SEdgeList::AssemblePolygon(SPolygon *dest, SEdge *errorAt, bool keepDir) co
// Create a new empty contour in our polygon, and finish assembling
// into that contour.
dest->AddEmptyContour();
if(!AssembleContour(first, last, dest->l.Last(), errorAt, keepDir)) {
if(!AssembleContour(first, last, dest->l.Last(), errorAt, keepDir, i+1)) {
allClosed = false;
}
// But continue assembling, even if some of the contours are open

View File

@ -53,7 +53,7 @@ public:
void AddEdge(Vector a, Vector b, int auxA=0, int auxB=0, int tag=0);
bool AssemblePolygon(SPolygon *dest, SEdge *errorAt, bool keepDir=false) const;
bool AssembleContour(Vector first, Vector last, SContour *dest,
SEdge *errorAt, bool keepDir) const;
SEdge *errorAt, bool keepDir, int start) const;
int AnyEdgeCrossings(Vector a, Vector b,
Vector *pi=NULL, SPointList *spl=NULL) const;
bool ContainsEdgeFrom(const SEdgeList *sel) const;