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

Method IntersectsCell

Common/DataModel/vtkKdNode.cxx:714–886  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

712
713//------------------------------------------------------------------------------
714int vtkKdNode::IntersectsCell(vtkCell* cell, int useDataBounds, int cellRegion, double* bounds)
715{
716 vtkIdType i;
717
718 if ((useDataBounds == 0) && (cellRegion >= 0))
719 {
720 if ((cellRegion >= this->MinID) && (cellRegion <= this->MaxID))
721 {
722 return 1; // the cell centroid is contained in this spatial region
723 }
724 }
725
726 double* cellBounds = nullptr;
727 int deleteCellBounds = (bounds == nullptr);
728
729 if (deleteCellBounds)
730 {
731 cellBounds = new double[6];
732
733 vtkPoints* pts = cell->GetPoints();
734 pts->Modified(); // VTK bug - so bounds will be re-calculated
735 pts->GetBounds(cellBounds);
736 }
737 else
738 {
739 cellBounds = bounds;
740 }
741
742 int intersects = -1;
743 int dim = cell->GetCellDimension();
744
745 if (!this->IntersectsBox(cellBounds[0], cellBounds[1], cellBounds[2], cellBounds[3],
746 cellBounds[4], cellBounds[5], useDataBounds))
747 {
748 intersects = 0; // cell bounding box is outside region
749 }
750 else if (this->ContainsBox(cellBounds[0], cellBounds[1], cellBounds[2], cellBounds[3],
751 cellBounds[4], cellBounds[5], useDataBounds))
752 {
753 intersects = 1; // cell bounding box is completely inside region
754 }
755 else
756 {
757 // quick test - if any of the points are in this region,
758 // then it intersects
759
760 vtkPoints* pts = cell->GetPoints();
761 vtkIdType npts = pts->GetNumberOfPoints();
762
763 for (i = 0; i < npts; i++)
764 {
765 double* pt = pts->GetPoint(i);
766 if (this->ContainsPoint(pt[0], pt[1], pt[2], useDataBounds))
767 {
768 intersects = 1;
769 break;
770 }
771 }

Callers 2

CreateCellListsMethod · 0.45
CutsToPartitionFunction · 0.45

Calls 15

GetBoundsMethod · 0.95
IntersectsBoxMethod · 0.95
ContainsBoxMethod · 0.95
ContainsPointMethod · 0.95
IntersectsRegionMethod · 0.95
IntersectBoxFunction · 0.85
DeleteMethod · 0.65
NewFunction · 0.50
GetPointsMethod · 0.45
ModifiedMethod · 0.45
GetCellDimensionMethod · 0.45
GetNumberOfPointsMethod · 0.45

Tested by

no test coverage detected