MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / InsertTriangle

Method InsertTriangle

GTE/Graphics/CLODMeshCreator.h:257–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255 }
256
257 void InsertTriangle(TriangleKey<true> const& tKey, Triangle t)
258 {
259 // Create the edge keys for the triangle.
260 std::array<EdgeKey<false>, 3> eKey =
261 {
262 EdgeKey<false>(tKey.V[0], tKey.V[1]),
263 EdgeKey<false>(tKey.V[1], tKey.V[2]),
264 EdgeKey<false>(tKey.V[2], tKey.V[0])
265 };
266
267 // Insert each edge into its endpoints' adjacency lists.
268 for (size_t i0 = 2, i1 = 0; i1 < 3; i0 = i1++)
269 {
270 mVertices[tKey.V[i1]].adjEdges.insert(eKey[i0]);
271 mVertices[tKey.V[i1]].adjEdges.insert(eKey[i1]);
272 mVertices[tKey.V[i1]].adjTriangles.insert(tKey);
273 }
274
275 for (size_t i = 0; i < 3; ++i)
276 {
277 auto emIter = mEdges.find(eKey[i]);
278 if (emIter == mEdges.end())
279 {
280 // The edge is encountered the first time. Insert it into
281 // the graph and into the heap. Insert the triangle into
282 // its adjacency list.
283 Edge& edge = mEdges[eKey[i]];
284 edge.adjTriangles.insert(tKey);
285 edge.record = mHeap.Insert(eKey[i], std::numeric_limits<float>::max());
286 }
287 else
288 {
289 // The edge already exists in the graph. Insert the
290 // triangle into its adjacency list.
291 emIter->second.adjTriangles.insert(tKey);
292 }
293 }
294
295 // Insert the triangle into the graph.
296 mTriangles.insert(std::make_pair(tKey, t));
297 }
298
299 void RemoveTriangle(TriangleKey<true> const& tKey)
300 {

Callers

nothing calls this directly

Calls 2

endMethod · 0.80
InsertMethod · 0.45

Tested by

no test coverage detected