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

Method DivideRegion

Common/DataModel/vtkOctreePointLocator.cxx:228–276  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

226
227//------------------------------------------------------------------------------
228void vtkOctreePointLocator::DivideRegion(vtkOctreePointLocatorNode* node, int* ordering, int level)
229{
230 if (!this->DivideTest(node->GetNumberOfPoints(), level))
231 {
232 return;
233 }
234 if (level >= this->Level)
235 {
236 this->Level = level + 1;
237 }
238
239 node->CreateChildNodes();
240 int numberOfPoints = node->GetNumberOfPoints();
241 vtkDataSet* ds = this->GetDataSet();
242
243 std::vector<int> points[7];
244 int i;
245 int subOctantNumberOfPoints[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
246 for (i = 0; i < numberOfPoints; i++)
247 {
248 int index = node->GetSubOctantIndex(ds->GetPoint(ordering[i]), 0);
249 if (index)
250 {
251 points[index - 1].push_back(ordering[i]);
252 }
253 else
254 {
255 ordering[subOctantNumberOfPoints[0]] = ordering[i];
256 }
257 subOctantNumberOfPoints[index]++;
258 }
259 int counter = 0;
260 int sizeOfInt = sizeof(int);
261 for (i = 0; i < 7; i++)
262 {
263 counter += subOctantNumberOfPoints[i];
264 if (!points[i].empty())
265 {
266 memcpy(ordering + counter, points[i].data(), subOctantNumberOfPoints[i + 1] * sizeOfInt);
267 }
268 }
269 counter = 0;
270 for (i = 0; i < 8; i++)
271 {
272 node->GetChild(i)->SetNumberOfPoints(subOctantNumberOfPoints[i]);
273 this->DivideRegion(node->GetChild(i), ordering + counter, level + 1);
274 counter += subOctantNumberOfPoints[i];
275 }
276}
277
278//------------------------------------------------------------------------------
279void vtkOctreePointLocator::BuildLocator()

Callers 1

BuildLocatorInternalMethod · 0.95

Calls 11

DivideTestMethod · 0.95
GetSubOctantIndexMethod · 0.80
GetNumberOfPointsMethod · 0.45
CreateChildNodesMethod · 0.45
GetDataSetMethod · 0.45
GetPointMethod · 0.45
push_backMethod · 0.45
emptyMethod · 0.45
dataMethod · 0.45
SetNumberOfPointsMethod · 0.45
GetChildMethod · 0.45

Tested by

no test coverage detected