9 #include "imstkCellMesh.h" 10 #include "imstkMacros.h" 13 #include <unordered_set> 36 std::array<std::uint32_t, 3> vertexIds;
38 TriCell(std::uint32_t id0, std::uint32_t id1, std::uint32_t id2)
43 if (vertexIds[0] > vertexIds[1])
45 std::swap(vertexIds[0], vertexIds[1]);
47 if (vertexIds[1] > vertexIds[2])
49 std::swap(vertexIds[1], vertexIds[2]);
51 if (vertexIds[0] > vertexIds[1])
53 std::swap(vertexIds[0], vertexIds[1]);
61 return (vertexIds[0] == other.vertexIds[0] && vertexIds[1] == other.vertexIds[1]
62 && vertexIds[2] == other.vertexIds[2]);
87 imstk::symCantor(static_cast<size_t>(k.vertexIds[0]), static_cast<size_t>(k.vertexIds[1]));
88 return imstk::symCantor(r, static_cast<size_t>(k.vertexIds[2]));
101 if (group1.position != group2.position)
103 return (group1.position.x() < group2.position.x());
106 if (group1.normal != group2.normal)
108 return (group1.normal.x() < group2.normal.x());
138 const bool computeDerivedData =
false);
147 const bool computeDerivedData =
false);
152 void computeTrianglesNormals();
158 void computeTriangleTangents();
163 void computeVertexNormals();
168 void computeVertexTangents();
173 Vec3d computeBarycentricWeights(
const int tetId,
const Vec3d& pos)
const override;
180 void optimizeForDataLocality();
190 void correctWindingOrder();
195 void computeUVSeamVertexGroups();
200 double getVolume()
override;
202 int getNumTriangles()
const {
return getNumCells(); }
204 std::shared_ptr<VecDataArray<int, 3>> getTriangleIndices()
const {
return getCells(); }
210 std::unique_ptr<SurfaceMesh>
clone()
212 return std::unique_ptr<SurfaceMesh>(cloneImplementation());
216 std::map<NormalGroup, std::shared_ptr<std::vector<size_t>>> m_UVSeamVertexGroups;
Utility for triangle comparison.
std::unique_ptr< SurfaceMesh > clone()
Polymorphic clone, hides the declaration in superclass return own type.
Returns a hash value for a PointEntry.
Represents a set of triangles & vertices via an array of Vec3d double vertices & Vec3i integer indice...
bool operator==(const Color &color_lhs, const Color &color_rhs)
Comparison operator.
Abstract template base class for all meshes that have homogenous cell types. This class allows templa...
Helper class for indentifying duplicate points.
This method is defined to allow for the map to be properly indexed by Texture objects.