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

Method Split

Common/DataModel/vtkCellTreeLocator.cxx:425–544  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

423
424 // -------------------------------------------------------------------------
425 void Split(T index, double min[3], double max[3], BucketsType& buckets)
426 {
427 const T& start = this->Nodes[index].Start();
428 const T& size = this->Nodes[index].Size();
429
430 if (size < this->NumberOfNodesPerLeaf)
431 {
432 return;
433 }
434
435 CellInfo* begin = &(this->CellsInfo[start]);
436 CellInfo* end = this->CellsInfo.data() + start + size;
437 CellInfo* mid = begin;
438
439 const double ext[3] = { max[0] - min[0], max[1] - min[1], max[2] - min[2] };
440 double iext[3];
441
442 for (uint8_t comp = 0; comp < 3; ++comp)
443 {
444 double const ext_comp = ext[comp];
445 iext[comp] = ext_comp == 0.0 ? this->NumberOfBuckets : this->NumberOfBuckets / ext_comp;
446 }
447
448 buckets.Reset();
449
450 for (const CellInfo* pc = begin; pc != end; ++pc)
451 {
452 for (uint8_t d = 0; d < 3; ++d)
453 {
454 double cen = (pc->Min[d] + pc->Max[d]) / 2.0;
455 double dblIdx = (cen - min[d]) * iext[d];
456 dblIdx = vtkMath::ClampValue(dblIdx, 0.0, static_cast<double>(this->NumberOfBuckets - 1));
457 size_t ind = static_cast<size_t>(dblIdx);
458
459 buckets[d][ind].Add(pc->Min[d], pc->Max[d]);
460 }
461 }
462
463 double cost = VTK_DOUBLE_MAX;
464 double plane = VTK_DOUBLE_MIN; // bad value in case it doesn't get setx
465 T dim = VTK_INT_MAX; // bad value in case it doesn't get set
466 T sum;
467 double lVol, rVol, c, lMaxValue, rMinValue;
468 int n, m;
469
470 for (uint8_t d = 0; d < 3; ++d)
471 {
472 sum = 0;
473
474 for (n = 0; n < this->NumberOfBuckets - 1; ++n)
475 {
476 lMaxValue = -VTK_DOUBLE_MAX;
477 rMinValue = VTK_DOUBLE_MAX;
478
479 for (m = 0; m <= n; ++m)
480 {
481 if (buckets[d][m].Max > lMaxValue)
482 {

Callers 1

operator()Method · 0.95

Calls 15

FindMinMaxMethod · 0.95
LeftPredicateClass · 0.85
CenterOrderClass · 0.85
MakeLeafMethod · 0.80
MakeNodeMethod · 0.80
GetRightChildIndexMethod · 0.80
GetLeftChildIndexMethod · 0.80
StartMethod · 0.45
SizeMethod · 0.45
dataMethod · 0.45
ResetMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected