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

Method GenerateRepresentation

Filters/FlowPaths/vtkModifiedBSPTree.cxx:486–539  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

484
485//------------------------------------------------------------------------------
486void vtkModifiedBSPTree::GenerateRepresentation(int level, vtkPolyData* pd)
487{
488 this->BuildLocator();
489 if (this->mRoot == nullptr)
490 {
491 return;
492 }
493 nodestack ns;
494 boxlist bl;
495 BSPNode* node;
496 ns.push(this->mRoot.get());
497 // lets walk the tree and get all the level n node boxes
498 while (!ns.empty())
499 {
500 node = ns.top();
501 ns.pop();
502 if (node->depth == level)
503 {
504 bl.emplace_back(node->Bounds);
505 }
506 else
507 {
508 if (node->mChild[0])
509 {
510 ns.push(node->mChild[0]);
511 if (node->mChild[1])
512 {
513 ns.push(node->mChild[1]);
514 }
515 ns.push(node->mChild[2]);
516 }
517 else if (level == -1)
518 {
519 bl.emplace_back(node->Bounds);
520 }
521 }
522 }
523
524 // Ok, now create cube(oid)s and stuff'em into a polydata thingy
525 vtkAppendPolyData* polys = vtkAppendPolyData::New();
526 size_t s = bl.size();
527 for (size_t i = 0; i < s; i++)
528 {
529 vtkCubeSource* cube = vtkCubeSource::New();
530 cube->SetBounds(bl[i].bounds);
531 cube->Update();
532 polys->AddInputConnection(cube->GetOutputPort());
533 cube->Delete();
534 }
535 polys->Update();
536 pd->SetPoints(polys->GetOutput()->GetPoints());
537 pd->SetPolys(polys->GetOutput()->GetPolys());
538 polys->Delete();
539}
540
541//------------------------------------------------------------------------------
542void vtkModifiedBSPTree::GenerateRepresentationLeafs(vtkPolyData* pd)

Callers 1

Calls 15

BuildLocatorMethod · 0.95
popMethod · 0.80
SetPolysMethod · 0.80
GetPolysMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
pushMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45
emplace_backMethod · 0.45
sizeMethod · 0.45
SetBoundsMethod · 0.45

Tested by 1