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

Method testIsConvexEdge

src/utils/quickhull/QuickHull.cpp:335–350  ·  view source on GitHub ↗

Return true if a given edge is convex and false otherwise

Source from the content-addressed store, hash-verified

333
334// Return true if a given edge is convex and false otherwise
335bool QuickHull::testIsConvexEdge(const QHHalfEdgeStructure::Edge* edge, decimal epsilon) {
336
337 // Get the two neighbor faces
338 assert(edge->twinEdge != nullptr);
339 QHHalfEdgeStructure::Face* face1 = edge->face;
340 QHHalfEdgeStructure::Face* face2 = edge->twinEdge->face;
341
342 // We test if the center of face1 is below the face2 plane
343 if (computePointToPlaneDistance(face1->centroid, face2->normal, face2->centroid) >= -epsilon) return false;
344
345 // We test if the center of face2 is below the face1 plane
346 if (computePointToPlaneDistance(face2->centroid, face1->normal, face1->centroid) >= -epsilon) return false;
347
348 // If both tests are true, the edge is convex
349 return true;
350}
351
352// Find the horizon (edges) forming the separation between the faces that are visible from the new vertex and the faces that are not visible
353void QuickHull::findHorizon(const Vector3& vertex, QHHalfEdgeStructure::Face* face,

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected