9 #include "imstkSceneObject.h" 10 #include "imstkCellMesh.h" 11 #include "imstkMacros.h" 13 #include <unordered_set> 18 template<
typename T,
int N>
class VecDataArray;
19 class CollidingObject;
33 PbdObjectCutting(std::shared_ptr<PbdObject> pbdObj, std::shared_ptr<CollidingObject> cutObj);
39 double getEpsilon()
const {
return m_epsilon; }
43 void setEpsilon(
const double eps) { m_epsilon = eps; }
55 void addVertices(std::shared_ptr<SurfaceMesh> pbdMesh,
63 std::shared_ptr<std::vector<size_t>> vertexIndices,
74 std::shared_ptr<VecDataArray<int, N>> cells = pbdMesh->getCells();
75 const int nCells = cells->size();
76 const int nNewCells = newCells->size();
78 cells->reserve(nCells + nNewCells);
79 for (
int i = 0; i < nNewCells; i++)
81 const Vec3i& cell = (*newCells)[i];
82 cells->push_back(cell);
83 for (
int j = 0; j < N; j++)
85 m_addConstraintVertices->insert(cell[j]);
94 std::shared_ptr<std::vector<size_t>> elementIndices,
97 double m_epsilon = 0.1;
99 std::shared_ptr<PbdObject> m_objA =
nullptr;
100 std::shared_ptr<CollidingObject> m_objB =
nullptr;
102 std::shared_ptr<std::unordered_set<size_t>> m_removeConstraintVertices = std::make_shared<std::unordered_set<size_t>>();
103 std::shared_ptr<std::unordered_set<size_t>> m_addConstraintVertices = std::make_shared<std::unordered_set<size_t>>();
void modifyTriangles(std::shared_ptr< SurfaceMesh > pbdMesh, std::shared_ptr< std::vector< size_t >> elementIndices, std::shared_ptr< VecDataArray< int, 3 >> elements)
Modify existing elements of pbdObj.
void addCells(std::shared_ptr< CellMesh< N >> pbdMesh, std::shared_ptr< VecDataArray< int, N >> newCells)
Add new elements to pbdObj.
void apply()
Applies the cut when called.
This class defines a cutting interaction between a PbdObject and a CollidingObject. PbdObjectCutting::apply can be used to perform a discrete cut given the current states of both objects.
void modifyVertices(std::shared_ptr< SurfaceMesh > pbdMesh, std::shared_ptr< std::vector< size_t >> vertexIndices, std::shared_ptr< VecDataArray< double, 3 >> vertices, std::shared_ptr< VecDataArray< double, 3 >> initialVertices)
Modify current vertices of pbdObj.
Base class for all scene objects. A scene object can optionally be visible and collide with other sce...
void addVertices(std::shared_ptr< SurfaceMesh > pbdMesh, std::shared_ptr< VecDataArray< double, 3 >> vertices, std::shared_ptr< VecDataArray< double, 3 >> initialVertices)
Add new vertices to pbdObj.
Abstract template base class for all meshes that have homogenous cell types. This class allows templa...
double getEpsilon() const
Epsilon controls the distance a point needs to be to be considered "inside" the cutting zone...