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

Method FindCellsWithinBounds

Common/DataModel/vtkCellTreeLocator.cxx:1203–1252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1201//------------------------------------------------------------------------------
1202template <typename T>
1203void CellTree<T>::FindCellsWithinBounds(double* bbox, vtkIdList* cells)
1204{
1205 NodeInfoStack ns;
1206 double cellBounds[6], *cellBoundsPtr;
1207 cellBoundsPtr = cellBounds;
1208 vtkBoundingBox TestBox(bbox);
1209
1210 TCellTreeNode* n0 = &this->Nodes.front();
1211 // create a box for the root
1212 double* dataBBox = this->DataBBox;
1213 vtkBoundingBox lbox, rbox,
1214 rootbox(dataBBox[0], dataBBox[1], dataBBox[2], dataBBox[3], dataBBox[4], dataBBox[5]);
1215 ns.push(NodeBoxLevel(n0, BoxLevel(rootbox, 0)));
1216 while (!ns.empty())
1217 {
1218 n0 = ns.top().first;
1219 vtkBoundingBox& nodebox = ns.top().second.first;
1220 if (TestBox.Intersects(nodebox))
1221 {
1222 if (n0->IsLeaf())
1223 {
1224 for (T i = 0; i < n0->Size(); i++)
1225 {
1226 T cellId = this->Leaves[n0->Start() + i];
1227 this->Locator->GetCellBounds(cellId, cellBoundsPtr);
1228 vtkBoundingBox box(cellBoundsPtr);
1229 if (TestBox.Intersects(box))
1230 {
1231 cells->InsertNextId(cellId);
1232 }
1233 }
1234 ns.pop();
1235 }
1236 else
1237 {
1238 int lev = ns.top().second.second;
1239 SplitNodeBox(n0, nodebox, lbox, rbox);
1240 TCellTreeNode* n1 = &this->Nodes.at(n0->GetLeftChildIndex());
1241 TCellTreeNode* n2 = &this->Nodes.at(n0->GetLeftChildIndex() + 1);
1242 ns.pop();
1243 ns.push(NodeBoxLevel(n1, BoxLevel(lbox, lev + 1)));
1244 ns.push(NodeBoxLevel(n2, BoxLevel(rbox, lev + 1)));
1245 }
1246 }
1247 else
1248 {
1249 ns.pop();
1250 }
1251 }
1252}
1253VTK_ABI_NAMESPACE_END
1254} // namespace
1255

Callers

nothing calls this directly

Calls 14

BuildLocatorMethod · 0.95
SplitNodeBoxFunction · 0.85
InsertNextIdMethod · 0.80
popMethod · 0.80
GetLeftChildIndexMethod · 0.80
frontMethod · 0.45
pushMethod · 0.45
emptyMethod · 0.45
IntersectsMethod · 0.45
IsLeafMethod · 0.45
SizeMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected