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

Method ExpandCuts

Filters/ParallelDIY2/vtkNativePartitioningStrategy.cxx:436–474  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

434
435//------------------------------------------------------------------------------
436std::vector<vtkBoundingBox> vtkNativePartitioningStrategy::ExpandCuts(
437 const std::vector<vtkBoundingBox>& cuts, const vtkBoundingBox& bounds)
438{
439 vtkBoundingBox cutsBounds;
440 for (const auto& bbox : cuts)
441 {
442 cutsBounds.AddBox(bbox);
443 }
444
445 if (!bounds.IsValid() || !cutsBounds.IsValid() || cutsBounds.Contains(bounds))
446 {
447 // nothing to do.
448 return cuts;
449 }
450
451 std::vector<vtkBoundingBox> result = cuts;
452 for (auto& bbox : result)
453 {
454 if (!bbox.IsValid())
455 {
456 continue;
457 }
458
459 double bds[6];
460 bbox.GetBounds(bds);
461 for (int face = 0; face < 6; ++face)
462 {
463 if (bds[face] == cutsBounds.GetBound(face))
464 {
465 bds[face] = (face % 2 == 0) ? std::min(bds[face], bounds.GetBound(face))
466 : std::max(bds[face], bounds.GetBound(face));
467 }
468 }
469 bbox.SetBounds(bds);
470 assert(bbox.IsValid()); // input valid implies output is valid too.
471 }
472
473 return result;
474}
475
476VTK_ABI_NAMESPACE_END

Callers

nothing calls this directly

Calls 9

AddBoxMethod · 0.80
GetBoundMethod · 0.80
minFunction · 0.50
maxFunction · 0.50
assertFunction · 0.50
IsValidMethod · 0.45
ContainsMethod · 0.45
GetBoundsMethod · 0.45
SetBoundsMethod · 0.45

Tested by

no test coverage detected