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

Defines the logical negation of a region. More...

#include <Mesh/Geometry/regionnegate.h>

Inheritance diagram for RegionNegate:
[legend]

Public Member Functions

 RegionNegate ()
 
 RegionNegate (const RegionNegate &r)
 
 ~RegionNegate () override
 
void clear ()
 
virtual RegionNegateclone () const
 
RegionNegatecloneRegion () const override
 
bool contains (const Vector3d &p) const override
 
void destroy () override
 
bool getBoundingBox (Vector3d &minimum, Vector3d &maximum) const override
 
bool isNull () const override
 
RegionNegateoperator= (const RegionNegate &b)
 
void setRegion (const Region &region)
 
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 set the region to negate using setRegion(). The result of contains() will be equivalent to the logical negation of the result of calling contains() on the region assigned to this object. Unless the region set for this object is null, the bounding box of the negated region will be infinite.

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

When first constructed, a RegionNegate object holds a null region, so it will start its life as a region spanning the entire 3D space (ie an unbounded region).

See also
RegionIntersection, RegionUnion, RegionTransform

Constructor & Destructor Documentation

◆ RegionNegate() [1/2]

Constructs an unconstrained region spanning the whole 3D space.

◆ RegionNegate() [2/2]

RegionNegate ( const RegionNegate r)
Parameters
rThe region to copy.

◆ ~RegionNegate()

~RegionNegate ( )
override

Member Function Documentation

◆ clear()

void clear ( )

Resets the region to negate to be a null region. This will make the result of contains() always true regardless of the argument, since contains() returns false for null regions and the negation of a null region is the infinite region (ie all points in the 3D space).

◆ clone()

RegionNegate * clone ( ) const
virtual

◆ cloneRegion()

RegionNegate * 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 not in the region previously assigned by setRegion().

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 a negated region is always infinite.

Returns
Always true for RegionNegate.
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=()

RegionNegate & operator= ( const RegionNegate b)

◆ setRegion()

void setRegion ( const Region region)
Parameters
regionThe region to negate.

◆ 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.