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

Method BuildTree

Common/DataModel/vtkBSPCuts.cxx:316–378  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

314}
315//------------------------------------------------------------------------------
316void vtkBSPCuts::BuildTree(vtkKdNode* kd, int idx)
317{
318 int dim = this->Dim[idx];
319
320 if (this->Npoints)
321 {
322 kd->SetNumberOfPoints(this->Npoints[idx]);
323 }
324
325 if (this->Lower[idx] > 0)
326 {
327 vtkKdNode* left = vtkKdNode::New();
328 vtkKdNode* right = vtkKdNode::New();
329
330 kd->SetDim(dim);
331
332 double b2[6];
333 double db2[6];
334
335 kd->GetBounds(b2);
336 kd->GetDataBounds(db2);
337
338 b2[dim * 2 + 1] = this->Coord[idx]; // new upper bound for lower half
339
340 if (this->LowerDataCoord)
341 {
342 db2[dim * 2 + 1] = this->LowerDataCoord[idx];
343 }
344 else
345 {
346 db2[dim * 2 + 1] = this->Coord[idx];
347 }
348
349 left->SetBounds(b2[0], b2[1], b2[2], b2[3], b2[4], b2[5]);
350 left->SetDataBounds(db2[0], db2[1], db2[2], db2[3], db2[4], db2[5]);
351
352 kd->GetBounds(b2);
353 kd->GetDataBounds(db2);
354
355 b2[dim * 2] = this->Coord[idx]; // new lower bound for upper half
356
357 if (this->UpperDataCoord)
358 {
359 db2[dim * 2] = this->UpperDataCoord[idx];
360 }
361 else
362 {
363 db2[dim * 2] = this->Coord[idx];
364 }
365
366 right->SetBounds(b2[0], b2[1], b2[2], b2[3], b2[4], b2[5]);
367 right->SetDataBounds(db2[0], db2[1], db2[2], db2[3], db2[4], db2[5]);
368
369 kd->AddChildNodes(left, right);
370
371 this->BuildTree(left, this->Lower[idx]);
372 this->BuildTree(right, this->Upper[idx]);
373 }

Callers 1

CreateCutsMethod · 0.95

Calls 9

SetDimMethod · 0.80
AddChildNodesMethod · 0.80
SetIDMethod · 0.80
NewFunction · 0.50
SetNumberOfPointsMethod · 0.45
GetBoundsMethod · 0.45
GetDataBoundsMethod · 0.45
SetBoundsMethod · 0.45
SetDataBoundsMethod · 0.45

Tested by

no test coverage detected