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

Method DivideRegion

Common/DataModel/vtkKdTree.cxx:1240–1310  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1238
1239//------------------------------------------------------------------------------
1240int vtkKdTree::DivideRegion(vtkKdNode* kd, float* c1, int* ids, int level)
1241{
1242 int ok = this->DivideTest(kd->GetNumberOfPoints(), level);
1243
1244 if (!ok)
1245 {
1246 return 0;
1247 }
1248
1249 int maxdim = this->SelectCutDirection(kd);
1250
1251 kd->SetDim(maxdim);
1252
1253 int dim1 = maxdim; // best cut direction
1254 int dim2 = -1; // other valid cut directions
1255 int dim3 = -1;
1256
1257 int otherDirections = this->ValidDirections ^ (1 << maxdim);
1258
1259 if (otherDirections)
1260 {
1261 int x = otherDirections & (1 << vtkKdTree::XDIM);
1262 int y = otherDirections & (1 << vtkKdTree::YDIM);
1263 int z = otherDirections & (1 << vtkKdTree::ZDIM);
1264
1265 if (x)
1266 {
1267 dim2 = vtkKdTree::XDIM;
1268
1269 if (y)
1270 {
1271 dim3 = vtkKdTree::YDIM;
1272 }
1273 else if (z)
1274 {
1275 dim3 = vtkKdTree::ZDIM;
1276 }
1277 }
1278 else if (y)
1279 {
1280 dim2 = vtkKdTree::YDIM;
1281
1282 if (z)
1283 {
1284 dim3 = vtkKdTree::ZDIM;
1285 }
1286 }
1287 else if (z)
1288 {
1289 dim2 = vtkKdTree::ZDIM;
1290 }
1291 }
1292
1293 this->DoMedianFind(kd, c1, ids, dim1, dim2, dim3);
1294
1295 if (kd->GetLeft() == nullptr)
1296 {
1297 return 0; // unable to divide region further

Callers 2

BuildLocatorInternalMethod · 0.95

Calls 5

DivideTestMethod · 0.95
SelectCutDirectionMethod · 0.95
DoMedianFindMethod · 0.95
SetDimMethod · 0.80
GetNumberOfPointsMethod · 0.45

Tested by

no test coverage detected