iMSTK
Interactive Medical Simulation Toolkit
|
Closed mesh to mesh collision with brute force strategy. It can handle closed SurfaceMesh vs PointSet, LineMesh, & SurfaceMesh. Note: This CD method cannot yet automatically determine the closed SurfaceMesh given two unordered inputs. Ensure the second input/B is the closed SurfaceMesh. More...
#include <imstkClosedSurfaceMeshToMeshCD.h>
Public Member Functions | |
void | setGenerateEdgeEdgeContacts (bool genEdgeEdgeContacts) |
If true, edge to edge contacts will be generated default true. | |
void | setGenerateVertexTriangleContacts (bool genVertexTriangleContacts) |
If true, vertex to triangle contacts will be generated default true. | |
void | setDoBroadPhase (const bool doBroadPhase) |
Get/Set whether to do AABB broad phase. The volume bounded by the object could be larger than the volume of the pointset. For instance triangle on a single plane vs a point. | |
bool | getDoBroadPhase () const |
void | setPadding (const Vec3d &padding) |
Set padding to the broad phase (AABB tests) | |
const Vec3d & | getPadding () const |
void | setProximity (const double proximity) |
Any edges with vertices not within this proximity will not have edges checked. This can be used to greatly reduce the # of edge-edge checks. | |
double | getProximity () const |
![]() | |
virtual const std::string | getTypeName () const =0 |
Returns collision detection type string name. | |
const std::shared_ptr< CollisionData > | getCollisionData () const |
Returns output collision data. | |
const std::shared_ptr< CollisionData > | getCollisionData (int i) const |
const std::shared_ptr< std::vector< std::shared_ptr< CollisionData > > > & | getCollisionDataVector () const |
size_t | getCollisionDataVectorSize () const |
void | setGenerateCD (const bool generateA, const bool generateB) |
If generateA is false, CD data will not be generated for input0,A Similarly, if generateB is false, CD data will not be generated for input1,B. | |
void | setInputGeometryA (std::shared_ptr< Geometry > geometryA) |
void | setInputGeometryB (std::shared_ptr< Geometry > geometryB) |
![]() | |
std::shared_ptr< Geometry > | getInput (size_t port=0) const |
Returns input geometry given port, returns nullptr if doesn't exist. | |
std::shared_ptr< Geometry > | getOutput (size_t port=0) const |
Returns output geometry given port, returns nullptr if doesn't exist. | |
void | setInput (std::shared_ptr< Geometry > inputGeometry, size_t port=0) |
Set the input at the port. | |
void | update () |
Do the actual algorithm. | |
Protected Member Functions | |
void | computeCollisionDataAB (std::shared_ptr< Geometry > geomA, std::shared_ptr< Geometry > geomB, std::vector< CollisionElement > &elementsA, std::vector< CollisionElement > &elementsB) override |
Compute collision data for AB simultaneously. | |
void | vertexToTriangleTest (std::shared_ptr< Geometry > geomA, std::shared_ptr< Geometry > geomB, std::vector< CollisionElement > &elementsA, std::vector< CollisionElement > &elementsB) |
void | lineMeshEdgeToTriangleTest (std::shared_ptr< Geometry > geomA, std::shared_ptr< Geometry > geomB, std::vector< CollisionElement > &elementsA, std::vector< CollisionElement > &elementsB) |
void | surfMeshEdgeToTriangleTest (std::shared_ptr< Geometry > geomA, std::shared_ptr< Geometry > geomB, std::vector< CollisionElement > &elementsA, std::vector< CollisionElement > &elementsB) |
![]() | |
virtual bool | areInputsValid () override |
Check inputs are correct (always works reversibly) More... | |
virtual void | requestUpdate () override |
Compute the collision data. | |
virtual void | computeCollisionDataA (std::shared_ptr< Geometry > imstkNotUsed(geomA), std::shared_ptr< Geometry > imstkNotUsed(geomB), std::vector< CollisionElement > &imstkNotUsed(elementsA)) |
Compute collision data for side A (implement as if flip=true) | |
virtual void | computeCollisionDataB (std::shared_ptr< Geometry > imstkNotUsed(geomA), std::shared_ptr< Geometry > imstkNotUsed(geomB), std::vector< CollisionElement > &imstkNotUsed(elementsB)) |
Compute collision data for side B (implement as if flip=true) | |
![]() | |
void | setOutput (std::shared_ptr< Geometry > inputGeometry, const size_t port=0) |
Set the output at the port. | |
template<typename T > | |
void | setRequiredInputType (const size_t port) |
Declares the type for the port with the given number, also defines that the give port is required for the filter to run correctly. | |
template<typename T > | |
void | setOptionalInputType (const size_t port) |
Declares the type for the port with the given number, the data for this port is optional and may be omitted. | |
void | setNumInputPorts (const size_t numPorts) |
Get/Set the amount of input ports. | |
imstkGetMacro (NumInputPorts, size_t) | |
void | setNumOutputPorts (const size_t numPorts) |
Get/Set the amount of output ports. | |
imstkGetMacro (NumOutputPorts, size_t) | |
Additional Inherited Members | |
![]() | |
using | GeometryCheck = std::function< bool(Geometry *)> |
using | TypeCheckContainer = std::unordered_map< size_t, GeometryCheck > |
![]() | |
std::shared_ptr< std::vector< std::shared_ptr< CollisionData > > > | m_collisionDataVector |
bool | m_flipOutput = false |
bool | m_generateCD_A = true |
bool | m_generateCD_B = true |
bool | m_computeColDataAImplemented = true |
bool | m_computeColDataBImplemented = true |
![]() | |
TypeCheckContainer | m_requiredTypeChecks |
TypeCheckContainer | m_optionalTypeChecks |
Closed mesh to mesh collision with brute force strategy. It can handle closed SurfaceMesh vs PointSet, LineMesh, & SurfaceMesh. Note: This CD method cannot yet automatically determine the closed SurfaceMesh given two unordered inputs. Ensure the second input/B is the closed SurfaceMesh.
It produces vertex-triangle, edge-edge, vertex-edge, & vertex-vertex collision data.
It's exact implementation roughly follows along with Pierre Terdiman's "Contact Generation for Meshes" but further described with GJK instead of brute force closest point determination in "Game Physics Pearls"
It resolves vertices by computing signed distances using the psuedonormal method. This allows it to resolve very deep penetrations.
If enabled, it may resolve edge-edge contact by brute force as well. This is an extremely costly operation in brute force and is off by default. Additionally it cannot find the globally best edge to resolve too.
Extrapolation is used past an opening based on the nearest elements normal. So some openings are ok depending on the intention. For instance, a triangle mesh plane is valid, assuming "beneath" the plane is inside and above is outside.
Definition at line 47 of file imstkClosedSurfaceMeshToMeshCD.h.