37 return std::make_shared<Vertex>(
v);
42 return std::make_shared<Edge>(
v0,
v1);
52 std::pair<int,int> ekey(v0, v1);
61 std::shared_ptr<Edge> edge =
mECreator(v0, v1);
65 for (
int i = 0; i < 2; ++i)
68 std::shared_ptr<Vertex> vertex;
69 auto viter =
mVMap.find(v);
70 if (viter ==
mVMap.end())
82 vertex = viter->second;
90 if (vertex->E[1].lock())
101 auto adjacent = vertex->E[0].lock();
107 for (
int j = 0; j < 2; ++j)
109 if (adjacent->V[j] == v)
111 adjacent->E[j] = edge;
117 edge->E[i] = adjacent;
126 std::pair<int,int> ekey(v0, v1);
127 auto eiter =
mEMap.find(ekey);
128 if (eiter ==
mEMap.end())
135 std::shared_ptr<Edge> edge = eiter->second;
138 for (
int i = 0; i < 2; ++i)
141 auto viter =
mVMap.find(edge->V[i]);
142 if (viter ==
mVMap.end())
149 std::shared_ptr<Vertex> vertex = viter->second;
157 if (vertex->E[0].lock() == edge)
160 vertex->E[0] = vertex->E[1];
161 vertex->E[1].reset();
163 else if (vertex->E[1].lock() == edge)
165 vertex->E[1].reset();
174 if (!vertex->E[0].lock() && !vertex->E[1].lock())
176 mVMap.erase(vertex->V);
180 auto adjacent = edge->E[i].lock();
183 for (
int j = 0; j < 2; ++j)
185 if (adjacent->E[j].lock() == edge)
187 adjacent->E[j].reset();
200 for (
auto const& element :
mVMap)
202 auto vertex = element.second;
203 if (!vertex->E[0].lock() || !vertex->E[1].lock())
EMap const & GetEdges() const
std::shared_ptr< Edge >(* ECreator)(int, int)
#define LogInformation(message)
std::shared_ptr< Edge > Insert(int v0, int v1)
bool mAssertOnNonmanifoldInsertion
std::shared_ptr< Vertex >(* VCreator)(int)
static std::shared_ptr< Vertex > CreateVertex(int v0)
std::map< int, std::shared_ptr< Vertex > > VMap
#define LogError(message)
virtual ~VEManifoldMesh()
static std::shared_ptr< Edge > CreateEdge(int v0, int v1)
std::map< std::pair< int, int >, std::shared_ptr< Edge > > EMap
VEManifoldMesh(VCreator vCreator=nullptr, ECreator eCreator=nullptr)
void AssertOnNonmanifoldInsertion(bool doAssert)
VMap const & GetVertices() const
bool Remove(int v0, int v1)