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

Method FindCell

Filters/FlowPaths/vtkModifiedBSPTree.cxx:925–980  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

923
924//------------------------------------------------------------------------------
925vtkIdType vtkModifiedBSPTree::FindCell(
926 double x[3], double, vtkGenericCell* cell, int& subId, double pcoords[3], double* weights)
927{
928 this->BuildLocator();
929 if (this->mRoot == nullptr)
930 {
931 return -1;
932 }
933 // check if x outside of bounds
934 if (!vtkAbstractCellLocator::IsInBounds(this->mRoot->Bounds, x))
935 {
936 return -1;
937 }
938 vtkIdType cellId;
939 nodestack ns;
940 BSPNode* node;
941 ns.push(this->mRoot.get());
942 double closestPoint[3], dist2;
943 //
944 while (!ns.empty())
945 {
946 node = ns.top();
947 ns.pop();
948 if (node->mChild[0])
949 { // this must be a parent node
950 if (node->mChild[0]->Inside(x))
951 {
952 ns.push(node->mChild[0]);
953 }
954 if (node->mChild[1] && node->mChild[1]->Inside(x))
955 {
956 ns.push(node->mChild[1]);
957 }
958 if (node->mChild[2]->Inside(x))
959 {
960 ns.push(node->mChild[2]);
961 }
962 }
963 else
964 { // a leaf, so test the cells
965 for (int i = 0; i < node->num_cells; i++)
966 {
967 cellId = node->sorted_cell_lists[0][i];
968 if (vtkAbstractCellLocator::InsideCellBounds(x, cellId))
969 {
970 this->DataSet->GetCell(cellId, cell);
971 if (cell->EvaluatePosition(x, closestPoint, subId, pcoords, dist2, weights) == 1)
972 {
973 return cellId;
974 }
975 }
976 }
977 }
978 }
979 return -1;
980}
981
982//------------------------------------------------------------------------------

Callers 15

RequestDataMethod · 0.45
AddDataSetMethod · 0.45
FindInLocatorMethod · 0.45
FindAndUpdateCellMethod · 0.45
TestCellLocatorsFunction · 0.45
RequestDataMethod · 0.45
ExtractSliceFromSeedFunction · 0.45
RequestDataMethod · 0.45
RequestDataMethod · 0.45

Calls 9

BuildLocatorMethod · 0.95
IsInBoundsFunction · 0.85
popMethod · 0.80
InsideMethod · 0.80
pushMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45
GetCellMethod · 0.45
EvaluatePositionMethod · 0.45

Tested by 1

TestCellLocatorsFunction · 0.36