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

Method InsertEdgesIntoEdgeTable

Common/DataModel/vtkSimpleCellTessellator.cxx:1433–1635  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1431//------------------------------------------------------------------------------
1432//
1433void vtkSimpleCellTessellator::InsertEdgesIntoEdgeTable(vtkTriangleTile& tri)
1434{
1435 double* local = nullptr;
1436 vtkIdType tmp;
1437 vtkIdType l, r;
1438 vtkIdType cellId = this->GenericCell->GetId();
1439
1440 constexpr double alpha = 0.5;
1441 assert("check: normalized alpha" && alpha > 0 && alpha < 1);
1442
1443 // First setup the point reference count:
1444 for (int i = 0; i < 3; i++)
1445 {
1446 this->EdgeTable->IncrementPointReferenceCount(tri.GetPointId(i));
1447 }
1448
1449 double* leftPoint = this->Scalars;
1450 double* midPoint = this->Scalars + this->PointOffset;
1451 double* rightPoint = midPoint + this->PointOffset;
1452
1453 // Loop over all edges:
1454 // For each edge:
1455 // if in hash table: incr ref
1456 // else: evaluate & put in table ref = 1
1457 for (int j = 0; j < 3; j++)
1458 {
1459 l = TRIANGLE_EDGES_TABLE[j][0];
1460 r = TRIANGLE_EDGES_TABLE[j][1];
1461
1462 vtkIdType leftId = tri.GetPointId(l);
1463 vtkIdType rightId = tri.GetPointId(r);
1464
1465 if (leftId > rightId)
1466 {
1467 // ensure that the left point has the smallest id
1468 // hence, evaluation occurs in the same direction in any case
1469 // the computations of error and interpolation will not suffer from
1470 // numerical precision.
1471 tmp = leftId;
1472 leftId = rightId;
1473 rightId = tmp;
1474
1475 tmp = l;
1476 l = r;
1477 r = tmp;
1478 }
1479
1480 double* left = tri.GetVertex(l);
1481 double* right = tri.GetVertex(r);
1482
1483 memcpy(leftPoint + PARAMETRIC_OFFSET, left, sizeof(double) * 3);
1484 memcpy(rightPoint + PARAMETRIC_OFFSET, right, sizeof(double) * 3);
1485
1486 // Check first in the hash table
1487 vtkIdType ptId = -1;
1488
1489 // To calculate the edge ref count, we either:
1490 // - find it in the hash table

Callers 3

InitTetraTileMethod · 0.95
TriangulateTriangleMethod · 0.95
RefineMethod · 0.80

Calls 15

GetFixedSubdivisionsMethod · 0.95
CheckPointMethod · 0.80
UpdateMaxErrorMethod · 0.80
SetEdgeParentMethod · 0.80
InsertPointAndScalarMethod · 0.80
GetEdgeIdsMethod · 0.80
assertFunction · 0.50

Tested by

no test coverage detected