iMSTK
Interactive Medical Simulation Toolkit
imstkSurfaceMeshCut.h
1 /*
2 ** This file is part of the Interactive Medical Simulation Toolkit (iMSTK)
3 ** iMSTK is distributed under the Apache License, Version 2.0.
4 ** See accompanying NOTICE for details.
5 */
6 
7 #pragma once
8 
9 #include "imstkMeshCut.h"
10 
11 namespace imstk
12 {
13 // vertex on the plane (0), positive side (+1), negative side (-1)
14 // pt0 and pt1 follows the triangle's indexing order when tri is presented
15 // c0 and c1 are cutting coordinates stored in cutData
16 enum class TriCutType
17 {
18  NONE = 0,
19  /* triangle is not cut through
20  * pt0 (-+1)
21  * / \
22  * c0 / \
23  * / tri \
24  * pt1 (+-1)------(?)
25  */
26  EDGE,
27  /*
28  * (-+1)
29  * / \
30  * / \
31  * / tri \
32  * (-+1)------(0) pt0/c0
33  */
34  VERT,
35  /*
36  * (+-1) pt1
37  * / \
38  * c1 / \
39  * / tri \
40  * (-+1)--c0--(+-1) pt0
41  */
42  EDGE_EDGE,
43  /*
44  * pt0 (+-1)
45  * / \
46  * c0 / \
47  * / tri \
48  * pt1 (-+1)------(0) c1
49  */
50  EDGE_VERT,
51  /*
52  * pt0/c0 (0)------(+-1)
53  * / \ /
54  * / \ /
55  * / \ /
56  * (-+1)------(0) pt1/c1
57  */
58  VERT_VERT
59 };
60 
67 class SurfaceMeshCut : public MeshCut
68 {
69 public:
71  ~SurfaceMeshCut() override = default;
72 
73  std::shared_ptr<SurfaceMesh> getOutputMesh();
74  void setInputMesh(std::shared_ptr<SurfaceMesh> inputSurf);
75 
76 protected:
77  void refinement(std::shared_ptr<AbstractCellMesh> outputGeom,
78  std::map<int, bool>& cutVerts) override;
79 
80  void splitVerts(std::shared_ptr<AbstractCellMesh> outputGeom,
81  std::map<int, bool>& cutVerts,
82  std::shared_ptr<Geometry> cuttingGeom) override;
83 
84  std::shared_ptr<std::vector<CutData>> generateCutData(
85  std::shared_ptr<Geometry> cuttingGeom,
86  std::shared_ptr<AbstractCellMesh> geomToCut) override;
87 
88  std::shared_ptr<std::vector<CutData>> generateImplicitCutData(
89  std::shared_ptr<AnalyticalGeometry> cuttingGeom,
90  std::shared_ptr<SurfaceMesh> geomToCut);
91 
92  std::shared_ptr<std::vector<CutData>> generateSurfaceMeshCutData(
93  std::shared_ptr<SurfaceMesh> cuttingGeom,
94  std::shared_ptr<SurfaceMesh> geomToCut);
95 };
96 } // namespace imstk
Compound Geometry.
Base abstract class for discrete cut algorithms.
Definition: imstkMeshCut.h:41
This filter cuts the triangles of a SurfaceMesh into smaller triangles using input cutting geometry...