iMSTK
Interactive Medical Simulation Toolkit
Classes | Public Member Functions | Protected Attributes | List of all members
imstk::NeedlePbdCH Class Reference

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>

Inheritance diagram for imstk::NeedlePbdCH:
Inheritance graph
[legend]
Collaboration diagram for imstk::NeedlePbdCH:
Collaboration graph
[legend]

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 PunctureDatagetPunctureData ()
 
- Public Member Functions inherited from imstk::PbdCollisionHandling
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
 
- Public Member Functions inherited from imstk::CollisionHandling
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< CollidingObjectgetInputObjectA () const
 Get the input objects.
 
std::shared_ptr< CollidingObjectgetInputObjectB () const
 
virtual std::shared_ptr< GeometrygetHandlingGeometryA ()
 Get the geometry used for handling defaults to the collision geometry.
 
virtual std::shared_ptr< GeometrygetHandlingGeometryB ()
 
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 CollisionDatagetInputCollisionData () 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< PbdObjectm_threadObj
 
std::shared_ptr< LineMeshm_threadMesh
 
std::shared_ptr< PbdObjectm_pbdTissueObj
 
std::shared_ptr< SurfaceMeshm_tissueSurfMesh
 
std::shared_ptr< PbdObjectm_needleObj
 
std::shared_ptr< LineMeshm_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
 
- Protected Attributes inherited from imstk::PbdCollisionHandling
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
 
- Protected Attributes inherited from imstk::CollisionHandling
std::shared_ptr< CollidingObjectm_inputObjectA
 
std::shared_ptr< CollidingObjectm_inputObjectB
 
std::shared_ptr< const CollisionDatam_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

- Public Types inherited from imstk::PbdCollisionHandling
enum  ObjType { PbdDeformable, PbdRigid, Colliding }
 
- Protected Types inherited from imstk::PbdCollisionHandling
enum  ConstraintType {
  BodyBody = 0, BodyVertex, BodyEdge, BodyTriangle,
  VertexVertex, VertexEdge, EdgeEdge, VertexTriangle,
  EdgeEdgeCCD, NumTypes
}
 
- Protected Member Functions inherited from imstk::PbdCollisionHandling
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)
 
- Protected Member Functions inherited from imstk::CollisionHandling
void updateCollisionData (std::shared_ptr< const CollisionData > data)
 

Detailed Description

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.


The documentation for this class was generated from the following files: