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

Method SplitCell

Filters/General/vtkIntersectionPolyDataFilter.cxx:635–1214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

633}
634
635vtkCellArray* vtkIntersectionPolyDataFilter::Impl ::SplitCell(vtkPolyData* input, vtkIdType cellId,
636 const vtkIdType* cellPts, IntersectionMapType* map, vtkPolyData* interLines, int inputIndex,
637 int numCurrCells)
638{
639 // Copy down the SurfaceID array that tells which surface the point belongs
640 // to
641 vtkIdTypeArray* surfaceMapper;
642 surfaceMapper = vtkIdTypeArray::SafeDownCast(interLines->GetPointData()->GetArray("SurfaceID"));
643
644 // Array to keep track of which points are on the boundary of the cell
645 vtkSmartPointer<vtkIdTypeArray> cellBoundaryPt = vtkSmartPointer<vtkIdTypeArray>::New();
646 // Array to tell whether the original cell points lie on the intersecting
647 // line
648 int CellPointOnInterLine[3] = { 0, 0, 0 };
649
650 // Gather points from the cell
651 vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
652 vtkSmartPointer<vtkPointLocator> merger = vtkSmartPointer<vtkPointLocator>::New();
653 merger->SetTolerance(this->Tolerance);
654 merger->InitPointInsertion(points, input->GetBounds());
655
656 double xyz[3];
657 for (int i = 0; i < 3; i++)
658 {
659 if (cellPts[i] >= input->GetNumberOfPoints())
660 {
661 vtkGenericWarningMacro(<< "invalid point read 1");
662 }
663 input->GetPoint(cellPts[i], xyz);
664 merger->InsertNextPoint(xyz);
665 cellBoundaryPt->InsertNextValue(1);
666 }
667
668 // Set up line cells and array to track the just the intersecting lines
669 // on the cell.
670 vtkSmartPointer<vtkCellArray> lines = vtkSmartPointer<vtkCellArray>::New();
671 vtkSmartPointer<vtkCellArray> interceptlines = vtkSmartPointer<vtkCellArray>::New();
672
673 double p0[3], p1[3], p2[3];
674 input->GetPoint(cellPts[0], p0);
675 input->GetPoint(cellPts[1], p1);
676 input->GetPoint(cellPts[2], p2);
677
678 // This maps the point IDs for the vtkPolyData passed to
679 // vtkDelaunay2D back to the original IDs in interLines. NOTE: The
680 // point IDs from the cell are not stored here.
681 std::map<vtkIdType, vtkIdType> ptIdMap;
682
683 IntersectionMapIteratorType iterLower = map->lower_bound(cellId);
684 IntersectionMapIteratorType iterUpper = map->upper_bound(cellId);
685 // Get all the lines associated with the original cell
686 while (iterLower != iterUpper)
687 {
688 vtkIdType lineId = iterLower->second;
689 vtkIdType nLinePts;
690 const vtkIdType* linePtIds;
691 interLines->GetLines()->GetCellAtId(lineId, nLinePts, linePtIds);
692

Callers 1

SplitMeshMethod · 0.95

Calls 15

GetLoopsMethod · 0.95
OrientMethod · 0.95
lower_boundMethod · 0.80
InsertCellPointMethod · 0.80
GetCellEdgeNeighborsMethod · 0.80
SetLinesMethod · 0.80
CheckLineMethod · 0.80
BoundedTriangulateMethod · 0.80
SetOffsetMethod · 0.80
GetPolysMethod · 0.80
AddToNewCellMapMethod · 0.80
DeleteMethod · 0.65

Tested by

no test coverage detected