9 #include "imstkGeometryAlgorithm.h" 10 #include "imstkMath.h" 13 #include <unordered_set> 18 class AbstractCellMesh;
19 class AnalyticalGeometry;
22 template<
typename T,
int N>
class VecDataArray;
30 int ptIds[2] = { -1, -1 };
49 void requestUpdate()
override;
51 std::shared_ptr<std::map<int, int>> getCutVertMap() {
return m_CutVertMap; }
53 imstkGetMacro(
CutData, std::shared_ptr<std::vector<CutData>>);
54 imstkSetMacro(
CutData, std::shared_ptr<std::vector<CutData>>);
56 imstkGetMacro(CutGeometry, std::shared_ptr<Geometry>);
57 imstkSetMacro(CutGeometry, std::shared_ptr<Geometry>);
59 imstkGetMacro(Epsilon,
double);
60 imstkSetMacro(Epsilon,
double);
62 imstkGetMacro(RemoveConstraintVertices, std::shared_ptr<std::unordered_set<size_t>>);
63 imstkGetMacro(AddConstraintVertices, std::shared_ptr<std::unordered_set<size_t>>);
69 virtual std::shared_ptr<std::vector<CutData>> generateCutData(
70 std::shared_ptr<Geometry> cuttingGeom,
71 std::shared_ptr<AbstractCellMesh> geomToCut) = 0;
79 virtual void refinement(
80 std::shared_ptr<AbstractCellMesh> outputGeom,
81 std::map<int, bool>& cutVerts) = 0;
89 virtual void splitVerts(
90 std::shared_ptr<AbstractCellMesh> outputGeom,
91 std::map<int, bool>& cutVerts,
92 std::shared_ptr<Geometry> cuttingGeom) = 0;
98 int ptBoundarySign(
const Vec3d& pt, std::shared_ptr<Geometry> geometry);
102 std::set<int>& cellSet)
104 std::set<int> nonRepeatNeighborVerts;
105 for (
const auto& cellId : cellSet)
107 for (
int i = 0; i < N; i++)
109 const int ptId = (*cells)[cellId][i];
110 if (nonRepeatNeighborVerts.find(ptId) != nonRepeatNeighborVerts.end())
112 nonRepeatNeighborVerts.erase(ptId);
116 nonRepeatNeighborVerts.insert(ptId);
120 return (nonRepeatNeighborVerts.size() >= 2);
123 bool pointProjectionInSurface(
const Vec3d& pt, std::shared_ptr<SurfaceMesh> surface);
125 std::shared_ptr<std::vector<CutData>> m_CutData =
nullptr;
127 std::shared_ptr<std::map<int, int>> m_CutVertMap =
128 std::make_shared<std::map<int, int>>();
130 std::shared_ptr<Geometry> m_CutGeometry =
nullptr;
132 std::shared_ptr<std::unordered_set<size_t>> m_RemoveConstraintVertices =
nullptr;
133 std::shared_ptr<std::unordered_set<size_t>> m_AddConstraintVertices =
nullptr;
135 double m_Epsilon = 0.001;
Simple dynamic array implementation that also supports event posting and viewing/facade.
Abstract base class for geometry algorithms. GeometryAlgorithms take N input geometries and produce N...
Base abstract class for discrete cut algorithms.