Delete all the faces visible from the vertex to be added
| 275 | |
| 276 | // Delete all the faces visible from the vertex to be added |
| 277 | void QuickHull::deleteVisibleFaces(const Array<QHHalfEdgeStructure::Face*>& visibleFaces, |
| 278 | QHHalfEdgeStructure& convexHull, |
| 279 | Array<uint32>& orphanPoints, |
| 280 | const Array<QHHalfEdgeStructure::Vertex*>& horizonVertices, |
| 281 | MemoryAllocator& allocator) { |
| 282 | |
| 283 | const uint32 nbFaces = visibleFaces.size(); |
| 284 | |
| 285 | Set<QHHalfEdgeStructure::Vertex*> verticesToRemove(allocator); |
| 286 | |
| 287 | // For each visible face |
| 288 | for (uint32 i=0; i < nbFaces; i++) { |
| 289 | |
| 290 | // Add all the remaining points associated with this face to the array of orphan points |
| 291 | orphanPoints.addRange(visibleFaces[i]->conflictPoints); |
| 292 | |
| 293 | // For each vertex of the face to remove |
| 294 | const QHHalfEdgeStructure::Edge* firstFaceEdge = visibleFaces[i]->edge; |
| 295 | const QHHalfEdgeStructure::Edge* faceEdge = firstFaceEdge; |
| 296 | do { |
| 297 | |
| 298 | QHHalfEdgeStructure::Vertex* vertex = faceEdge->startVertex; |
| 299 | |
| 300 | // If the vertex is not part of the horizon |
| 301 | if (!testIsVertexInHorizon(vertex, horizonVertices)) { |
| 302 | |
| 303 | // Add the vertex to the set of vertices to be removed |
| 304 | verticesToRemove.add(vertex); |
| 305 | } |
| 306 | |
| 307 | faceEdge = faceEdge->nextFaceEdge; |
| 308 | |
| 309 | } while(faceEdge != firstFaceEdge); |
| 310 | |
| 311 | // Remove the face from the current convex hull |
| 312 | convexHull.removeFace(visibleFaces[i]); |
| 313 | } |
| 314 | |
| 315 | // Remove the vertices to be removed |
| 316 | for (auto it = verticesToRemove.begin(); it != verticesToRemove.end(); ++it) { |
| 317 | convexHull.removeVertex(*it); |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | // Return true if the vertex is part of horizon edges |
| 322 | bool QuickHull::testIsVertexInHorizon(QHHalfEdgeStructure::Vertex* vertex, const Array<QHHalfEdgeStructure::Vertex*>& horizonVertices) { |
nothing calls this directly
no test coverage detected