Fix topological issues (if any) that might have been created during faces merge
| 627 | |
| 628 | // Fix topological issues (if any) that might have been created during faces merge |
| 629 | void QuickHull::fixTopologicalIssues(QHHalfEdgeStructure& convexHull, QHHalfEdgeStructure::Face* face, const Array<Vector3>& points, |
| 630 | Set<QHHalfEdgeStructure::Face*>& deletedFaces) { |
| 631 | |
| 632 | // Here we want to make sure that each vertex of the convex hull has at least |
| 633 | // three adjacent faces |
| 634 | |
| 635 | QHHalfEdgeStructure::Edge* edgeError; |
| 636 | |
| 637 | // While we can find an edge with an error (a redundant vertex) in the face |
| 638 | do { |
| 639 | |
| 640 | edgeError = nullptr; |
| 641 | |
| 642 | // For each vertex of the face we check if the incoming and outgoing edge have |
| 643 | // the same face on the opposite side |
| 644 | QHHalfEdgeStructure::Edge* firstInEdge = face->edge; |
| 645 | QHHalfEdgeStructure::Edge* inEdge = firstInEdge; |
| 646 | do { |
| 647 | |
| 648 | assert(inEdge != nullptr); |
| 649 | |
| 650 | QHHalfEdgeStructure::Edge* outEdge = inEdge->nextFaceEdge; |
| 651 | |
| 652 | if (inEdge->twinEdge->face == outEdge->twinEdge->face) { |
| 653 | edgeError = inEdge; |
| 654 | break; |
| 655 | } |
| 656 | |
| 657 | // Move to the next edge of the face |
| 658 | inEdge = outEdge; |
| 659 | } |
| 660 | while (inEdge != firstInEdge); |
| 661 | |
| 662 | // If we have found an edge with error (redundant vertex) |
| 663 | if (edgeError != nullptr) { |
| 664 | fixTopologicalIssueAtEdge(convexHull, face, edgeError, points, deletedFaces); |
| 665 | } |
| 666 | |
| 667 | } while (edgeError != nullptr); |
| 668 | } |
| 669 | |
| 670 | // Fix topological issue at a given edge |
| 671 | void QuickHull::fixTopologicalIssueAtEdge(QHHalfEdgeStructure& convexHull, QHHalfEdgeStructure::Face* face, |
nothing calls this directly
no outgoing calls
no test coverage detected