| 1156 | //------------------------------------------------------------------------------ |
| 1157 | template <typename T> |
| 1158 | void 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 | //------------------------------------------------------------------------------ |
| 1202 | template <typename T> |
nothing calls this directly
no test coverage detected