MCPcopy Create free account
hub / github.com/Kitware/VTK / TriangulateTriangle

Method TriangulateTriangle

Common/DataModel/vtkSimpleCellTessellator.cxx:2471–2548  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2469
2470//------------------------------------------------------------------------------
2471void vtkSimpleCellTessellator::TriangulateTriangle(vtkGenericAdaptorCell* cell, vtkIdType* localIds,
2472 vtkIdType* ids, const vtkIdType* edgeIds, vtkGenericAttributeCollection* att,
2473 vtkDoubleArray* points, vtkCellArray* cellArray, vtkPointData* internalPd)
2474{
2475 assert("pre: cell_exixts" && cell != nullptr);
2476 assert("pre: localIds_exists" && localIds != nullptr);
2477 assert("pre: ids_exists" && ids != nullptr);
2478 assert("pre: edgeIds_exists" && edgeIds != nullptr);
2479
2480 // Save parameter for later use
2481 this->GenericCell = cell;
2482
2483 this->TessellatePoints = points;
2484 this->TessellateCellArray = cellArray;
2485 this->TessellatePointData = internalPd;
2486
2487 this->AttributeCollection = att;
2488
2489 if (this->CellIterator == nullptr)
2490 {
2491 this->CellIterator = cell->NewCellIterator();
2492 }
2493 this->EdgeIds = edgeIds;
2494
2495 this->SetGenericCell(cell);
2496
2497 vtkTriangleTile root;
2498 double* point;
2499
2500 int i;
2501 for (i = 0; i < 3; i++)
2502 {
2503 point = this->GenericCell->GetParametricCoords() + 3 * localIds[i];
2504 root.SetVertex(i, point);
2505 root.SetPointId(i, ids[i]);
2506 }
2507 root.SetOriginal();
2508
2509 // Init the edge table
2510 this->EdgeTable->SetNumberOfComponents(internalPd->GetNumberOfComponents());
2511
2512 this->PointOffset = internalPd->GetNumberOfComponents() + 6;
2513 this->AllocateScalars(this->PointOffset * 3);
2514
2515 this->InsertPointsIntoEdgeTable(root);
2516
2517 // Prepare the hash table with the top-level edges:
2518 this->InsertEdgesIntoEdgeTable(root);
2519
2520 std::queue<vtkTriangleTile> work;
2521 vtkTriangleTile begin = vtkTriangleTile(root);
2522 work.push(begin);
2523
2524 while (!work.empty())
2525 {
2526 vtkTriangleTile piece[4];
2527 vtkTriangleTile curr = work.front();
2528 work.pop();

Callers 2

TessellateFaceMethod · 0.95
TriangulateMethod · 0.95

Calls 15

AllocateScalarsMethod · 0.95
vtkTriangleTileClass · 0.85
popMethod · 0.80
assertFunction · 0.50
NewCellIteratorMethod · 0.45
SetGenericCellMethod · 0.45
GetParametricCoordsMethod · 0.45
SetVertexMethod · 0.45
SetPointIdMethod · 0.45

Tested by

no test coverage detected