| 1201 | //------------------------------------------------------------------------------ |
| 1202 | template <typename T> |
| 1203 | void 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 | } |
| 1253 | VTK_ABI_NAMESPACE_END |
| 1254 | } // namespace |
| 1255 |
nothing calls this directly
no test coverage detected