Workspace 6.21.5
|
Applies an arbitrary affine transformation to a region. More...
#include <Mesh/Geometry/regiontransform.h>
Public Member Functions | |
RegionTransform () | |
RegionTransform (const RegionTransform &r) | |
~RegionTransform () override | |
void | clear () |
virtual RegionTransform * | clone () const |
RegionTransform * | cloneRegion () const override |
bool | contains (const Vector3d &p) const override |
void | destroy () override |
bool | getBoundingBox (Vector3d &minimum, Vector3d &maximum) const override |
bool | isNull () const override |
RegionTransform & | operator= (const RegionTransform &b) |
void | setRegion (const Region ®ion) |
bool | setTransform (const TransformGroup &transform) |
bool | visit (RegionProcessor &processor) override |
Public Member Functions inherited from Region | |
virtual | ~Region ()=default |
virtual Region * | cloneRegion () 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 ¢er, double &radius) const |
virtual bool | isNull () const =0 |
virtual bool | visit (RegionProcessor &processor)=0 |
The typical way to use this class is to set the region to transform using setRegion() and the transform with setTransform(). Rather than attempting to apply the transform to the region itself, however, the class creates the illusion of this by applying the inverse transform to anything that would query the region, ie contains() and getBoundingBox() (and therefore getBoundingSphere() by virtue of it being implemented in terms of getBoundingBox() in the base class).
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.
A default-constructed RegionTransform object applies the identity transform, which leaves the region unchanged.
RegionTransform | ( | ) |
Constructs an unconstrained region spanning the whole 3D space.
RegionTransform | ( | const RegionTransform & | r | ) |
r | The region to copy. |
|
override |
void clear | ( | ) |
Resets the region to a null region and the transformation to the identity.
|
virtual |
|
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.
|
overridevirtual |
p | The point to test. |
Implements Region.
|
overridevirtual |
minimum | The corner of the bounding box corresponding to the minimum values of X, Y and Z. |
maximum | The corner of the bounding box corresponding to the maximum values of X, Y and Z. |
The bounding box for a transformed region is somewhat unintuitively complicated. The bounding box of the region is transformed, and then a new bounding box is calculated around all eight corners of the transformed box. This is necessary because shearing, non-uniform scaling and/or rotation make it impossible to know which corners of the box will ultimately be at the extremities of the transformed box.
Implements Region.
|
overridevirtual |
Implements Region.
RegionTransform & operator= | ( | const RegionTransform & | b | ) |
void setRegion | ( | const Region & | region | ) |
region | The region to transform. |
bool setTransform | ( | const TransformGroup & | transform | ) |
transform | The transformation to apply. |
|
overridevirtual |
Visit the specified region processor, invoking the correct processing function. Subclasses will need to override this to invoke the correct function.
Implements Region.