Reworked the fix of #784 for efficiency and robustness:

First, the same direction segments are chained as before, but this time
the remaining open polylines are collected to be processed in the 2nd step.

Second, the remaining open polylines are connected by a greedy algorithm
disregarding their original orientation. As the orientation of loops
created by the 2nd step is mixed, the orientation of these loops is
unknown, therfore a CCW orientation is enforced. The CCW heuristics
may fill holes and cavities, but no outer geometry will be lost.
This commit is contained in:
bubnikv 2018-03-15 17:14:13 +01:00
parent 1ae8684af1
commit 4f0c6dd879
2 changed files with 219 additions and 143 deletions

View file

@ -85,11 +85,11 @@ enum FacetEdgeType {
feHorizontal
};
class IntersectionPoint : public Point
class IntersectionReference
{
public:
IntersectionPoint() : point_id(-1), edge_id(-1) {};
// Inherits coord_t x, y
IntersectionReference() : point_id(-1), edge_id(-1) {};
IntersectionReference(int point_id, int edge_id) : point_id(point_id), edge_id(edge_id) {}
// Where is this intersection point located? On mesh vertex or mesh edge?
// Only one of the following will be set, the other will remain set to -1.
// Index of the mesh vertex.
@ -98,6 +98,15 @@ public:
int edge_id;
};
class IntersectionPoint : public Point, public IntersectionReference
{
public:
IntersectionPoint() {};
IntersectionPoint(int point_id, int edge_id, const Point &pt) : IntersectionReference(point_id, edge_id), Point(pt) {}
IntersectionPoint(const IntersectionReference &ir, const Point &pt) : IntersectionReference(ir), Point(pt) {}
// Inherits coord_t x, y
};
class IntersectionLine : public Line
{
public: