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

Method testPointInside

src/collision/shapes/ConvexMeshShape.cpp:185–202  ·  view source on GitHub ↗

Return true if a point is inside the collision shape

Source from the content-addressed store, hash-verified

183
184// Return true if a point is inside the collision shape
185bool ConvexMeshShape::testPointInside(const Vector3& localPoint, Collider* /*collider*/) const {
186
187 const HalfEdgeStructure& halfEdgeStructure = mConvexMesh->getHalfEdgeStructure();
188
189 // For each face plane of the convex mesh
190 for (uint32 f=0; f < mConvexMesh->getNbFaces(); f++) {
191
192 const HalfEdgeStructure::Face& face = halfEdgeStructure.getFace(f);
193 const Vector3& faceNormal = getFaceNormal(f);
194 const HalfEdgeStructure::Vertex& faceVertex = halfEdgeStructure.getVertex(face.faceVertices[0]);
195 const Vector3& facePoint = mConvexMesh->getVertex(faceVertex.vertexPointIndex);
196
197 // If the point is out of the face plane, it is outside of the convex mesh
198 if (computePointToPlaneDistance(localPoint, faceNormal, facePoint) > decimal(0.0)) return false;
199 }
200
201 return true;
202}
203
204// Return the local bounds of the shape in x, y and z directions
205/**

Callers

nothing calls this directly

Calls 3

getNbFacesMethod · 0.45
getVertexMethod · 0.45

Tested by

no test coverage detected