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

This class defines stitching of a PbdObject via different picking methods. Ray based stitching is default. More...

#include <imstkPbdObjectStitching.h>

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

Public Member Functions

 PbdObjectStitching (std::shared_ptr< PbdObject > obj1)
 
void beginStitch (const Vec3d &rayStart, const Vec3d &rayDir, const double maxDist=-1.0)
 Begin a ray point stitch. Stitches two points for separate elements. More...
 
void addStitchConstraints ()
 Compute/generate the constraints for stitching.
 
void removeStitchConstraints ()
 Clears all the stitches.
 
virtual void addConstraint (const std::vector< PbdParticleId > &ptsA, const std::vector< double > &weightsA, const std::vector< PbdParticleId > &ptsB, const std::vector< double > &weightsB, const double stiffnessA, const double stiffnessB)
 Add constraint between a point on each element given via barycentric coordinates pt position = weightA_0 * ptsA_0 + weightA_1 * ptsA_1 + ...
 
void setGeometryToStitch (std::shared_ptr< Geometry > geomToStitch, std::shared_ptr< PointwiseMap > map)
 Set a different geometry to pick with and a mapping back to the physics geometry to select the correct vertices.
 
std::shared_ptr< TaskNodegetPickingNode () const
 
void initGraphEdges (std::shared_ptr< TaskNode > source, std::shared_ptr< TaskNode > sink) override
 Setup connectivity of the compute graph.
 
void setStiffness (const double stiffness)
 Set/Get the stiffness, 0-1 value that alters the step size in the solver.
 
double getStiffness () const
 
void setStitchDistance (const double distance)
 Set/Get the maximum distance for which a stitch may be placed.
 
double getStitchDistance () const
 
void setPickingAlgorithm (std::shared_ptr< PickingAlgorithm > pickMethod)
 Get/Set the method use for picking, default is CellPicker.
 
std::shared_ptr< PickingAlgorithmgetPickingAlgorithm () const
 
- Public Member Functions inherited from imstk::SceneObject
 SceneObject (const std::string &name="SceneObject")
 
std::shared_ptr< TaskGraphgetTaskGraph () const
 Get the computational graph.
 
std::shared_ptr< GeometrygetVisualGeometry () const
 Sets the visual geometry, adds (sets the first) VisualModel.
 
void setVisualGeometry (std::shared_ptr< Geometry > geometry)
 
std::shared_ptr< VisualModelgetVisualModel (const int index) const
 Get/add visual model.
 
void addVisualModel (std::shared_ptr< VisualModel > visualModel)
 
void removeVisualModel (std::shared_ptr< VisualModel > visualModel)
 
std::shared_ptr< TaskNodegetUpdateNode () const
 Returns the computational node for updating.
 
std::shared_ptr< TaskNodegetUpdateGeometryNode () const
 Returns the computational node for updating geometry.
 
virtual void update ()
 Update the SceneObject, called during scene update.
 
virtual void visualUpdate ()
 Update the visuals, called before render.
 
virtual void updateGeometries ()
 Update the geometries.
 
virtual bool initialize ()
 Initialize the scene object.
 
void initGraphEdges ()
 Initializes the edges of the SceneObject's computational graph.
 
virtual void reset ()
 
- Public Member Functions inherited from imstk::Entity
 Entity (const std::string &name="Entity")
 
 SIGNAL (Entity, modified)
 
EntityID getID () const
 Get ID (ALWAYS query the ID in your code, DO NOT hardcode it) More...
 
virtual const std::string getTypeName () const
 
template<typename T >
std::shared_ptr< T > addComponent ()
 Create and return a component on this entity.
 
template<typename T >
std::shared_ptr< T > addComponent (std::string name)
 
void addComponent (std::shared_ptr< Component > component)
 Add existing component to entity.
 
std::shared_ptr< ComponentgetComponent (const unsigned int index) const
 Get a component by index.
 
template<typename T >
std::shared_ptr< T > getComponent () const
 Get the first component of type T.
 
template<typename T >
std::shared_ptr< T > getComponentN (const int index) const
 Get's the Nth component of type T.
 
template<class T >
bool containsComponent () const
 Check if contains component of type T.
 
bool containsComponent (std::shared_ptr< Component > component) const
 Check if contains given component.
 
template<typename T >
std::vector< std::shared_ptr< T > > getComponents () const
 Get all components of type T.
 
const std::vector< std::shared_ptr< Component > > & getComponents ()
 
void removeComponent (std::shared_ptr< Component > component)
 Remove component if it exists.
 
const std::string & getName () const
 Get/Set the name of the entity.
 
void setName (const std::string &name)
 
- Public Member Functions inherited from imstk::EventObject
template<typename T >
void postEvent (const T &e)
 Emits the event Direct observers will be immediately called, in sync Queued observers will receive the Command in their queue for later execution, reciever must implement doEvent.
 
template<typename T >
void queueEvent (const T &e)
 Queues event directly to this.
 
void doEvent ()
 Do an event, if none exists return.
 
void doAllEvents ()
 Do all the events in the event queue.
 
void foreachEvent (std::function< void(Command cmd)> func)
 Thread safe loop over all event commands, one can implement a custom handler.
 
void rforeachEvent (std::function< void(Command cmd)> func)
 thread safe reverse loop over all event commands, one can implement a custom handler
 
void clearEvents ()
 Removes all events from queue cleans up copies of the event.
 

Protected Member Functions

virtual void updateStitching ()
 Update picking state, this should move grasp points.
 
- Protected Member Functions inherited from imstk::SceneObject
virtual void postModifiedAll ()
 Posts modified for all geometries.
 

Protected Attributes

std::shared_ptr< TaskNodem_stitchingNode = nullptr
 
std::shared_ptr< Geometrym_geomToStitch = nullptr
 
std::shared_ptr< PointwiseMapm_geometryToStitchMap = nullptr
 
std::shared_ptr< PbdObjectm_objectToStitch = nullptr
 
std::shared_ptr< PickingAlgorithmm_pickMethod = nullptr
 
bool m_performStitch = false
 
double m_stiffness = 0.1
 
double m_maxStitchDist = -1.0
 
std::vector< std::shared_ptr< PbdBaryPointToPointConstraint > > m_constraints
 Array of PBD constraints.
 
- Protected Attributes inherited from imstk::SceneObject
std::shared_ptr< TaskGraphm_taskGraph = nullptr
 Computational Graph.
 
- Protected Attributes inherited from imstk::Entity
std::vector< std::shared_ptr< Component > > m_components
 
EntityID m_ID
 unique ID of entity
 
std::string m_name
 Not unique name.
 
- Protected Attributes inherited from imstk::EventObject
ParallelUtils::SpinLock eventQueueLock
 
std::deque< CommandeventQueue
 
std::vector< std::pair< std::string, std::vector< Observer > > > queuedObservers
 
std::vector< std::pair< std::string, std::vector< Observer > > > directObservers
 

Additional Inherited Members

- Public Types inherited from imstk::EventObject
using Observer = std::tuple< bool, std::weak_ptr< EventObject >, std::function< void(Event *)> >
 
- Static Protected Attributes inherited from imstk::Entity
static std::atomic< EntityID > m_count { 0 }
 current count of entities
 

Detailed Description

This class defines stitching of a PbdObject via different picking methods. Ray based stitching is default.

Definition at line 29 of file imstkPbdObjectStitching.h.

Member Function Documentation

◆ beginStitch()

void imstk::PbdObjectStitching::beginStitch ( const Vec3d &  rayStart,
const Vec3d &  rayDir,
const double  maxDist = -1.0 
)

Begin a ray point stitch. Stitches two points for separate elements.

Parameters
Globalspace ray start
Globalspace ray direction

Definition at line 130 of file imstkPbdObjectStitching.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ m_stiffness

double imstk::PbdObjectStitching::m_stiffness = 0.1
protected

Stiffness of stitches, when 1 the position is completely moved too the grasp point when stiffness < 1 it will slowly converge on the grasp point

Definition at line 122 of file imstkPbdObjectStitching.h.


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