37 for (
auto const& element : mesh.
mSMap)
39 Insert(element.first.V[0], element.first.V[1], element.first.V[2], element.first.V[3]);
57 return std::make_shared<Triangle>(
v0,
v1,
v2);
62 return std::make_shared<Tetrahedron>(
v0,
v1,
v2,
v3);
81 std::shared_ptr<Tetrahedron> tetra =
mSCreator(v0, v1, v2, v3);
85 for (
int i = 0; i < 4; ++i)
88 TriangleKey<false> tkey(tetra->V[opposite[0]], tetra->V[opposite[1]], tetra->V[opposite[2]]);
89 std::shared_ptr<Triangle>
face;
90 auto titer =
mTMap.find(tkey);
91 if (titer ==
mTMap.end())
94 face =
mTCreator(tetra->V[opposite[0]], tetra->V[opposite[1]], tetra->V[opposite[2]]);
104 face = titer->second;
112 if (face->T[1].lock())
123 auto adjacent = face->T[0].lock();
129 for (
int j = 0; j < 4; ++j)
131 if (adjacent->T[j].lock() ==
face)
133 adjacent->S[j] = tetra;
140 tetra->S[i] = adjacent;
150 auto siter =
mSMap.find(skey);
151 if (siter ==
mSMap.end())
158 std::shared_ptr<Tetrahedron> tetra = siter->second;
161 for (
int i = 0; i < 4; ++i)
164 auto face = tetra->T[i].lock();
172 if (
face->T[0].lock() == tetra)
178 else if (
face->T[1].lock() == tetra)
189 if (!
face->T[0].lock() && !
face->T[1].lock())
196 auto adjacent = tetra->S[i].lock();
199 for (
int j = 0; j < 4; ++j)
201 if (adjacent->S[j].lock() == tetra)
203 adjacent->S[j].reset();
222 for (
auto const& element :
mSMap)
224 auto tri = element.second;
225 if (!tri->S[0].lock() || !tri->S[1].lock())
std::map< TriangleKey< false >, std::shared_ptr< Triangle > > TMap
bool Remove(int v0, int v1, int v2, int v3)
#define LogInformation(message)
void AssertOnNonmanifoldInsertion(bool doAssert)
Triangle(int v0, int v1, int v2)
TSManifoldMesh(TCreator tCreator=nullptr, SCreator sCreator=nullptr)
TSManifoldMesh & operator=(TSManifoldMesh const &mesh)
#define LogError(message)
GLfloat GLfloat GLfloat GLfloat v3
std::shared_ptr< Tetrahedron >(* SCreator)(int, int, int, int)
TMap const & GetTriangles() const
GLfloat GLfloat GLfloat v2
std::map< TetrahedronKey< true >, std::shared_ptr< Tetrahedron > > SMap
Tetrahedron(int v0, int v1, int v2, int v3)
std::shared_ptr< Tetrahedron > Insert(int v0, int v1, int v2, int v3)
virtual ~TSManifoldMesh()
std::shared_ptr< Triangle >(* TCreator)(int, int, int)
bool mAssertOnNonmanifoldInsertion
static std::shared_ptr< Tetrahedron > CreateTetrahedron(int v0, int v1, int v2, int v3)
static std::shared_ptr< Triangle > CreateTriangle(int v0, int v1, int v2)
GLenum GLuint GLint GLenum face
SMap const & GetTetrahedra() const