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

Method GenerateRepresentation

Common/DataModel/vtkCellTreeLocator.cxx:1158–1199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1156//------------------------------------------------------------------------------
1157template <typename T>
1158void CellTree<T>::GenerateRepresentation(int level, vtkPolyData* pd)
1159{
1160 NodeInfoStack ns;
1161 BoxList bl;
1162
1163 TCellTreeNode* n0 = &this->Nodes.front();
1164 // create a box for the root
1165 double* dataBBox = this->DataBBox;
1166 vtkBoundingBox lbox, rbox,
1167 rootbox(dataBBox[0], dataBBox[1], dataBBox[2], dataBBox[3], dataBBox[4], dataBBox[5]);
1168 ns.push(NodeBoxLevel(n0, BoxLevel(rootbox, 0)));
1169 while (!ns.empty())
1170 {
1171 n0 = ns.top().first;
1172 int lev = ns.top().second.second;
1173 if (n0->IsLeaf() && ((lev == level) || (level == -1)))
1174 {
1175 bl.push_back(BoxLevel(ns.top().second.first, lev));
1176 ns.pop();
1177 }
1178 else if (n0->IsLeaf())
1179 {
1180 ns.pop();
1181 }
1182 else if (n0->IsNode())
1183 {
1184 SplitNodeBox(n0, ns.top().second.first, lbox, rbox);
1185 TCellTreeNode* n1 = &this->Nodes.at(n0->GetLeftChildIndex());
1186 TCellTreeNode* n2 = &this->Nodes.at(n0->GetLeftChildIndex() + 1);
1187 ns.pop();
1188 ns.push(NodeBoxLevel(n1, BoxLevel(lbox, lev + 1)));
1189 ns.push(NodeBoxLevel(n2, BoxLevel(rbox, lev + 1)));
1190 }
1191 }
1192 // For each node, add the bbox to our polydata
1193 for (auto const& b : bl)
1194 {
1195 double bounds[6];
1196 b.first.GetBounds(bounds);
1197 AddBox(pd, bounds, b.second);
1198 }
1199}
1200
1201//------------------------------------------------------------------------------
1202template <typename T>

Callers

nothing calls this directly

Calls 13

BuildLocatorMethod · 0.95
SplitNodeBoxFunction · 0.85
popMethod · 0.80
IsNodeMethod · 0.80
GetLeftChildIndexMethod · 0.80
AddBoxFunction · 0.70
frontMethod · 0.45
pushMethod · 0.45
emptyMethod · 0.45
IsLeafMethod · 0.45
push_backMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected