MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / buildNewFaces

Method buildNewFaces

src/utils/quickhull/QuickHull.cpp:244–274  ·  view source on GitHub ↗

Build the new faces that contain the new vertex and the horizon edges

Source from the content-addressed store, hash-verified

242
243// Build the new faces that contain the new vertex and the horizon edges
244void QuickHull::buildNewFaces(uint32 newVertexIndex,
245 Array<QHHalfEdgeStructure::Vertex*>& horizonVertices,
246 QHHalfEdgeStructure& convexHull,
247 Array<Vector3>& points,
248 Array<QHHalfEdgeStructure::Face*>& newFaces,
249 MemoryAllocator& allocator) {
250
251 // Add the new vertex to the convex hull
252 QHHalfEdgeStructure::Vertex* v = convexHull.addVertex(newVertexIndex);
253
254 Array<QHHalfEdgeStructure::Vertex*> faceVertices(allocator, 8);
255
256 // For each horizon edge
257 for (uint32 i=0; i < horizonVertices.size(); i += 2) {
258
259 QHHalfEdgeStructure::Vertex* v2 = horizonVertices[i];
260 QHHalfEdgeStructure::Vertex* v3 = horizonVertices[i+1];
261
262 // Create the vertices of a triangular face
263 faceVertices.add(v2);
264 faceVertices.add(v3);
265 faceVertices.add(v);
266
267 // Create a new face
268 QHHalfEdgeStructure::Face* face = convexHull.addFace(faceVertices, points, allocator);
269
270 newFaces.add(face);
271
272 faceVertices.clear();
273 }
274}
275
276// Delete all the faces visible from the vertex to be added
277void QuickHull::deleteVisibleFaces(const Array<QHHalfEdgeStructure::Face*>& visibleFaces,

Callers

nothing calls this directly

Calls 5

addVertexMethod · 0.45
sizeMethod · 0.45
addMethod · 0.45
addFaceMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected