https://mooseframework.inl.gov
Functions
CSGUtils Namespace Reference

Functions

CSG::CSGRegion getInnerRegion (const std::vector< std::reference_wrapper< const CSG::CSGSurface >> &surfaces, const libMesh::Point &origin)
 Get inner region of given surfaces, defined as the intersection of halfspaces of each surface. More...
 

Function Documentation

◆ getInnerRegion()

CSGRegion CSGUtils::getInnerRegion ( const std::vector< std::reference_wrapper< const CSG::CSGSurface >> &  surfaces,
const libMesh::Point origin 
)

Get inner region of given surfaces, defined as the intersection of halfspaces of each surface.

Here, the halfspace direction is determined based on the origin.

Parameters
surfacesList of references to surfaces used to define inner region. This should ideally be defined with the minimum number of surfaces needed to enclose the region
originPoint used to determine halfspace direction when defining intersected region
Returns
inner region defined by surfaces

Definition at line 19 of file CSGUtils.C.

21 {
22  CSGRegion inner_region;
23  for (const auto & surf_ref : surfaces)
24  {
25  const auto & surf = surf_ref.get();
26  const auto direction = surf.getHalfspaceFromPoint(origin);
27  auto halfspace = (direction == CSGSurface::Halfspace::POSITIVE) ? +surf : -surf;
28  inner_region = (inner_region.getRegionType() == CSGRegion::RegionType::EMPTY)
29  ? halfspace
30  : inner_region & halfspace;
31  }
32  return inner_region;
33 }
CSGRegions creates an internal representation of a CSG region, which can refer to an intersection...
Definition: CSGRegion.h:21
RegionType getRegionType() const
Get the region type.
Definition: CSGRegion.h:83