Workspace 6.21.5
Public Member Functions | List of all members
RegionIntersection Class Reference

Defines an intersection of an arbitrary number of regions. More...

#include <Mesh/Geometry/regionintersection.h>

Inheritance diagram for RegionIntersection:
[legend]

Public Member Functions

 RegionIntersection ()
 
 RegionIntersection (const RegionIntersection &r)
 
 ~RegionIntersection () override
 
void addRegion (const Region &region)
 
void clear ()
 
virtual RegionIntersectionclone () const
 
RegionIntersectioncloneRegion () const override
 
bool contains (const Vector3d &p) const override
 
void destroy () override
 
bool getBoundingBox (Vector3d &minimum, Vector3d &maximum) const override
 
bool isNull () const override
 
RegionIntersectionoperator= (const RegionIntersection &b)
 
bool visit (RegionProcessor &processor) override
 
- Public Member Functions inherited from Region
virtual ~Region ()=default
 
virtual RegioncloneRegion () const =0
 
virtual bool contains (const Vector3d &p) const =0
 
virtual void destroy ()=0
 
virtual bool getBoundingBox (Vector3d &minimum, Vector3d &maximum) const =0
 
virtual bool getBoundingSphere (Vector3d &center, double &radius) const
 
virtual bool isNull () const =0
 
virtual bool visit (RegionProcessor &processor)=0
 

Detailed Description

The typical way to use this class is to add regions using addRegion(). The result of contains() will be equivalent to calling contains() on the added regions and logically AND'ing the results. The bounding box will be the smallest box that contains all the added regions.

It should be noted that when adding regions using addRegion(), the function clones its argument and stores this copy. If the original region is subsequently be modified, those changes will not be reflected in this intersection object.

There is no facility to remove a region, but you can empty it with clear(), which makes it a null region to which you can add regions again from scratch.

See also
RegionUnion, RegionNegate, RegionTransform

Constructor & Destructor Documentation

◆ RegionIntersection() [1/2]

Constructs a null region.

◆ RegionIntersection() [2/2]

Parameters
rThe region to copy.

◆ ~RegionIntersection()

~RegionIntersection ( )
override

Member Function Documentation

◆ addRegion()

void addRegion ( const Region region)
Parameters
regionThe region to add to this object. It would normally not be a null region, since that forces the whole region intersection to be null regardless of whatever other regions are added.

◆ clear()

void clear ( )

Discards all regions held by this object.

◆ clone()

RegionIntersection * clone ( ) const
virtual

◆ cloneRegion()

RegionIntersection * cloneRegion ( ) const
inlineoverridevirtual

This function should be called clone() but the Visual Studio compilers do not handle covariant return types when multiple inheritance from a virtual base class is involved. Since Region is often combined with other Clonable classes such as ObjectGroup, we don't provide clone() but instead provide cloneRegion() which is effectively doing the same thing, albeit with the annoyance of a different function name.

Note that subclasses will need to tell DataExecution::TypedDataFactory about their cloneRegion() implementation explicitly if they do not also inherit from some other Clonable base class as well, since Region does not derive from Clonable (which means the template specializations for TypedDataFactory will not automatically detect cloneRegion()).

Implements Region.

◆ contains()

bool contains ( const Vector3d p) const
overridevirtual
Parameters
pThe point to test.
Returns
True if p is contained in all the regions held by this object. Note that if any of those regions are null, then contains() will always return false.

Implements Region.

◆ destroy()

void destroy ( )
overridevirtual

Destroys the object. This function is usually implemented by calling operator delete on the object.

See also
clone()

Implements Region.

◆ getBoundingBox()

bool getBoundingBox ( Vector3d minimum,
Vector3d maximum 
) const
overridevirtual
Parameters
minimumThe corner of the bounding box corresponding to the minimum values of X, Y and Z.
maximumThe corner of the bounding box corresponding to the maximum values of X, Y and Z.

The bounding box for an intersection region is the smallest box that can be determined which still contains all the points that would return true from a call to contains(). This will generally be smaller than the union of all the bounding boxes of the regions added to this object (see RegionUnion).

Returns
True if the bounding box could be defined. A return value of false indicates that the region is null. If the intersection of the regions held by this object do not all share some common overlapping region, the return value is also false.
See also
getBoundingSphere(), isNull()

Implements Region.

◆ isNull()

bool isNull ( ) const
overridevirtual
Returns
True if all regions held by this object are null.

Implements Region.

◆ operator=()

RegionIntersection & operator= ( const RegionIntersection b)

◆ visit()

bool visit ( RegionProcessor processor)
overridevirtual

Visit the specified region processor, invoking the correct processing function. Subclasses will need to override this to invoke the correct function.

Implements Region.