9 #include "imstkMacros.h" 10 #include "imstkMath.h" 11 #include "imstkPbdCollisionConstraint.h" 12 #include "imstkSceneObject.h" 14 #include <unordered_map> 18 class PbdBaryPointToPointConstraint;
20 class PickingAlgorithm;
49 double getStitchDistance()
const {
return m_maxStitchDist; }
57 void beginStitch(
const Vec3d& rayStart,
const Vec3d& rayDir,
const double maxDist = -1.0);
75 const std::vector<PbdParticleId>& ptsA,
76 const std::vector<double>& weightsA,
77 const std::vector<PbdParticleId>& ptsB,
78 const std::vector<double>& weightsB,
79 const double stiffnessA,
const double stiffnessB);
85 std::shared_ptr<PickingAlgorithm> getPickingAlgorithm()
const {
return m_pickMethod; }
94 m_geomToStitch = geomToStitch;
95 m_geometryToStitchMap = map;
98 std::shared_ptr<TaskNode> getPickingNode()
const {
return m_stitchingNode; }
100 void initGraphEdges(std::shared_ptr<TaskNode> source, std::shared_ptr<TaskNode> sink)
override;
109 std::shared_ptr<TaskNode> m_stitchingNode =
nullptr;
111 std::shared_ptr<Geometry> m_geomToStitch =
nullptr;
112 std::shared_ptr<PointwiseMap> m_geometryToStitchMap =
nullptr;
114 std::shared_ptr<PbdObject> m_objectToStitch =
nullptr;
116 std::shared_ptr<PickingAlgorithm> m_pickMethod =
nullptr;
118 bool m_performStitch =
false;
123 double m_maxStitchDist = -1.0;
128 std::vector<PbdConstraint*> m_collisionConstraints;
void addStitchConstraints()
Compute/generate the constraints for stitching.
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 = weight...
std::vector< std::shared_ptr< PbdBaryPointToPointConstraint > > m_constraints
Array of PBD constraints.
void setStitchDistance(const double distance)
Set/Get the maximum distance for which a stitch may be placed.
void beginStitch(const Vec3d &rayStart, const Vec3d &rayDir, const double maxDist=-1.0)
Begin a ray point stitch. Stitches two points for separate elements.
virtual void updateStitching()
Update picking state, this should move grasp points.
void setPickingAlgorithm(std::shared_ptr< PickingAlgorithm > pickMethod)
Get/Set the method use for picking, default is CellPicker.
void setStiffness(const double stiffness)
Set/Get the stiffness, 0-1 value that alters the step size in the solver.
This class defines stitching of a PbdObject via different picking methods. Ray based stitching is def...
Base class for all scene objects. A scene object can optionally be visible and collide with other sce...
void removeStitchConstraints()
Clears all the stitches.
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 correc...
void initGraphEdges()
Initializes the edges of the SceneObject's computational graph.