iMSTK
Interactive Medical Simulation Toolkit
|
Handles penetration constraints for the needle and the thread by creating a set of puncture points that are used to find the nearest segment on either the needle or the thread and constraining the tissue to the needle, or the thread to the tissue. This class assumes the mesh is not cut or otherwise modified during runtime. WARNING: This class currently assumes a tetrahedral mesh for the physics mesh of the punctureable pbdObject and a triangle mesh for the collision geometry of that object. More...
#include <imstkNeedlePbdCH.h>
Classes | |
struct | PunctureData |
struct | PuncturePoint |
Public Member Functions | |
void | init (std::shared_ptr< PbdObject > threadObj) |
Initialize interaction data. | |
void | stitch () |
Create stitching constraints on button press for four or more puncture points. | |
void | handle (const std::vector< CollisionElement > &elementsA, const std::vector< CollisionElement > &elementsB) override |
Handles puncture constraints for both the needle and the thread. | |
void | generateNewPunctureData () |
void | addPunctureConstraints () |
void | setNeedleToSurfaceStiffness (double stiffness) |
double | getNeedleToSurfaceStiffness () |
void | setSurfaceToNeedleStiffness (double stiffness) |
double | getSurfaceToNeedleStiffness () |
void | setThreadToSurfaceStiffness (double stiffness) |
double | getThreadToSurfaceStiffness () |
void | setSurfaceToThreadStiffness (double stiffness) |
double | getSurfaceToThreadStiffness () |
void | setPunctureDotThreshold (double threshold) |
double | getPunctureDotThreshold () |
const PunctureData & | getPunctureData () |
![]() | |
const std::vector< PbdConstraint * > & | getConstraints () const |
Return the constraints generated by this handler This list of constraints is ordered in orderCollisionConstraints. | |
std::pair< PbdParticleId, Vec3d > | getBodyAndContactPoint (const CollisionElement &elem, const CollisionSideData &data) |
Get the body particle id from the collision side as well as the contact point on the body (in global space) | |
double | getRestitution () const |
Get/Set the restitution, which gives how much velocity is removed along the contact normals during contact. | |
void | setRestitution (const double restitution) |
double | getFriction () const |
Get/Set the friction, which gives how much velocity is removed along the tangents during contact. | |
void | setFriction (const double friction) |
bool | getUseCorrectVelocity () const |
Get/Set whether velocity is corrected (in some cases this could cause instabilities) | |
void | setUseCorrectVelocity (const bool useCorrectVelocity) |
int | getCCDSubsteps () const |
Get/Set the number of substeps used in CCD constraints. | |
void | setCCDSubsteps (const int ccdSubsteps) |
void | setEnableBoundaryCollisions (const bool enableBoundaryCollisions) |
Get enableBoundaryCollision. | |
const bool | getEnableBoundaryCollisions () const |
void | setRigidBodyCompliance (const double compliance) |
Get/Set compliance of rigid body contacts. Defaults to 0 compliance/infinitely stiff. This is what is needed most of the time but sometimes making a contact a bit softer can be helpful. | |
double | getRigidBodyCompliance () const |
void | setDeformableStiffnessA (const double stiffness) |
Get/Set stiffness of deformable contacts. Defaults to 1.0. This is what is needed most of the time but sometimes making a contact a bit softer can be helpful. | |
double | getDeformableStiffnessA () const |
void | setDeformableStiffnessB (const double stiffness) |
double | getDeformableStiffnessB () const |
![]() | |
virtual const std::string | getTypeName () const =0 |
void | setInputObjectA (std::shared_ptr< CollidingObject > objectA) |
Set the input objects. | |
void | setInputObjectB (std::shared_ptr< CollidingObject > objectB) |
std::shared_ptr< CollidingObject > | getInputObjectA () const |
Get the input objects. | |
std::shared_ptr< CollidingObject > | getInputObjectB () const |
virtual std::shared_ptr< Geometry > | getHandlingGeometryA () |
Get the geometry used for handling defaults to the collision geometry. | |
virtual std::shared_ptr< Geometry > | getHandlingGeometryB () |
void | setInputCollisionData (std::shared_ptr< CollisionData > collisionData) |
Set/Get the input collision data used for handling. | |
void | setInputCollisionData (std::shared_ptr< std::vector< std::shared_ptr< CollisionData >>> collisionVectorData) |
Set/Get the input collision data used for handling This supports collating information from multiple collision detect algorithms. | |
std::shared_ptr< const CollisionData > | getInputCollisionData () const |
void | update () |
Handle the input collision data. | |
Protected Attributes | |
std::vector< bool > | m_isThreadPunctured |
std::vector< std::shared_ptr< SurfaceInsertionConstraint > > | pointTriangleConstraints |
std::vector< std::shared_ptr< PbdBaryPointToPointConstraint > > | m_stitchConstraints |
std::vector< std::shared_ptr< PbdConstraint > > | m_constraints |
std::vector< PbdConstraint * > | m_solverConstraints |
PunctureData | pData |
bool | m_stitch = false |
std::vector< Vec3d > | m_stitchPoints |
std::shared_ptr< PbdObject > | m_threadObj |
std::shared_ptr< LineMesh > | m_threadMesh |
std::shared_ptr< PbdObject > | m_pbdTissueObj |
std::shared_ptr< SurfaceMesh > | m_tissueSurfMesh |
std::shared_ptr< PbdObject > | m_needleObj |
std::shared_ptr< LineMesh > | m_needleMesh |
double | m_needleToSurfaceStiffness = 0.2 |
double | m_surfaceToNeedleStiffness = 0.2 |
double | m_threadToSurfaceStiffness = 0.2 |
double | m_surfaceToThreadStiffness = 0.2 |
bool | m_needlePunctured = false |
bool | m_threadPunctured = false |
double | m_threshold = 0.8 |
![]() | |
std::vector< PbdConstraint * > | m_constraintBins [NumTypes] |
std::vector< PbdConstraint * > | m_constraintCache [NumTypes] |
std::vector< PbdConstraint * > | m_collisionConstraints |
Vector of all collision constraints. | |
std::unordered_map< PbdCHTableKey, std::function< void(const ColElemSide &elemA, const ColElemSide &elemB)> > | m_funcTable |
![]() | |
std::shared_ptr< CollidingObject > | m_inputObjectA |
std::shared_ptr< CollidingObject > | m_inputObjectB |
std::shared_ptr< const CollisionData > | m_colData |
Collision data. | |
std::shared_ptr< std::vector< std::shared_ptr< CollisionData > > > | m_colVectorData |
Expansion to allow collision detection to return multiple types of collision data. | |
std::function< void()> | m_updateFunction = []() {} |
bool | m_clearData = true |
bool | m_processConstraints = true |
Additional Inherited Members | |
![]() | |
enum | ObjType { PbdDeformable, PbdRigid, Colliding } |
![]() | |
enum | ConstraintType { BodyBody = 0, BodyVertex, BodyEdge, BodyTriangle, VertexVertex, VertexEdge, EdgeEdge, VertexTriangle, EdgeEdgeCCD, NumTypes } |
![]() | |
std::array< PbdParticleId, 2 > | getEdge (const CollisionElement &elem, const CollisionSideData &side) |
std::array< PbdParticleId, 3 > | getTriangle (const CollisionElement &elem, const CollisionSideData &side) |
std::array< PbdParticleId, 1 > | getVertex (const CollisionElement &elem, const CollisionSideData &side) |
getVertex takes slightly differing paths than the others, as the cell vertex directly refers to the vertex buffer, not an index buffer | |
CollisionSideData | getDataFromObject (std::shared_ptr< CollidingObject > obj) |
Creates a CollisionSideData struct from the provided object, this gives all the info needed to response to collision. | |
PbdContactCase | getCaseFromElement (const ColElemSide &elem) |
Get the contact case from the collision element and data as additional context. | |
void | handleElementPair (ColElemSide sideA, ColElemSide sideB) |
Handle a single element. | |
virtual void | addConstraint_Body_V (const ColElemSide &sideA, const ColElemSide &sideB) |
virtual void | addConstraint_Body_E (const ColElemSide &sideA, const ColElemSide &sideB) |
virtual void | addConstraint_Body_T (const ColElemSide &sideA, const ColElemSide &sideB) |
virtual void | addConstraint_Body_Body (const ColElemSide &sideA, const ColElemSide &sideB) |
virtual void | addConstraint_V_T (const ColElemSide &sideA, const ColElemSide &sideB) |
virtual void | addConstraint_E_E (const ColElemSide &sideA, const ColElemSide &sideB) |
virtual void | addConstraint_E_E_CCD (const ColElemSide &sideA, const ColElemSide &sideB) |
virtual void | addConstraint_V_E (const ColElemSide &sideA, const ColElemSide &sideB) |
virtual void | addConstraint_V_V (const ColElemSide &sideA, const ColElemSide &sideB) |
template<class T > | |
T * | getCachedConstraint (ConstraintType type) |
![]() | |
void | updateCollisionData (std::shared_ptr< const CollisionData > data) |
Handles penetration constraints for the needle and the thread by creating a set of puncture points that are used to find the nearest segment on either the needle or the thread and constraining the tissue to the needle, or the thread to the tissue. This class assumes the mesh is not cut or otherwise modified during runtime. WARNING: This class currently assumes a tetrahedral mesh for the physics mesh of the punctureable pbdObject and a triangle mesh for the collision geometry of that object.
Definition at line 32 of file imstkNeedlePbdCH.h.