![]() |
Workspace 6.21.5
|
Describes a bounding box region in 3D space.
#include <Mesh/Geometry/boundingbox.h>
Public Member Functions | |
BoundingBox () | |
BoundingBox (const BoundingBox &box) | |
BoundingBox (const BoundingBoxMinimal &box) | |
BoundingBox (const Vector3d &corner1, const Vector3d &corner2) | |
BoundingBox (const Vector3d &starter) | |
Vector3d | calculateCenter () const |
void | clear () |
BoundingBox * | clone () const override |
BoundingBox * | cloneRegion () const override |
bool | contains (const Vector3d &p) const override |
void | destroy () override |
void | expand (const BoundingBox &box) |
bool | expand (const Region ®ion) |
void | expand (const Vector3d &p) |
bool | getBoundingBox (Vector3d &minimum, Vector3d &maximum) const override |
Vector3d | getMaximum () const |
Vector3d | getMinimum () const |
void | intersect (const BoundingBox &box) |
void | intersect (const Vector3d &boxMin, const Vector3d &boxMax) |
bool | isInfinite () const |
bool | isNull () const override |
bool | operator!= (const BoundingBox &v) const |
bool | operator== (const BoundingBox &b) const |
void | setInfinite () |
void | setMaximum (const Vector3d &max) |
void | setMinimum (const Vector3d &min) |
bool | visit (RegionProcessor &processor) override |
![]() | |
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 |
![]() | |
~ObjectGroup () override | |
bool | add (const QString &name, DataObject &obj) |
bool | canSerialize () const override |
ObjectGroup * | clone () const override=0 |
bool | empty () const |
void | ensureGroupHasData () |
void | erase (int index) |
DataObject * | getChild (const QString &name) |
const DataObject * | getChild (const QString &name) const |
DataObject & | getDataObject (int index) |
const DataObject & | getDataObject (int index) const |
int | getIndex (const QString &name) const |
const QString & | getName (int index) const |
virtual QString | getPreferedWidget (const QString &name) const |
bool | hasData () const |
bool | haveName (const QString &name) const |
bool | insert (const QString &name, DataObject &obj, int index=-1) |
bool | load (const QJsonDocument &doc) |
bool | load (const SerializedItem &item) override |
bool | save (QJsonDocument &doc) const |
bool | save (SerializedItem &item) const override |
unsigned | size () const |
![]() | |
virtual | ~Clonable ()=default |
virtual Clonable * | clone () const =0 |
![]() | |
virtual | ~Serialize ()=default |
virtual bool | canSerialize () const =0 |
virtual bool | load (const SerializedItem &item)=0 |
virtual bool | save (SerializedItem &item) const =0 |
Additional Inherited Members | |
![]() | |
ObjectGroup () | |
void | clear () |
ObjectGroup & | operator= (const ObjectGroup &rhs) |
bool | operator== (const ObjectGroup &rhs) const |
void | swap (ObjectGroup &rhs) |
BoundingBox | ( | ) |
Constructs a null bounding box.
BoundingBox | ( | const BoundingBox & | box | ) |
box | The bounding box to copy. |
BoundingBox | ( | const BoundingBoxMinimal & | box | ) |
box | The bounding box to copy. |
BoundingBox | ( | const Vector3d & | starter | ) |
starter | The bounding box will be constructed with its minimum and maximum set to this value. |
BoundingBox | ( | const Vector3d & | corner1, |
const Vector3d & | corner2 | ||
) |
corner1 | One corner of the bounding box. |
corner2 | The corner diagonally opposite corner1. |
The caller only needs to ensure that the two corners are diagonally opposite. The constructor works out for itself what the minimum and maximum values should be. Note that it is possible for the minimum and maximum to be different to both corner1 and corner2.
Vector3d calculateCenter | ( | ) | const |
void clear | ( | ) |
Sets the bounding box to a null region.
|
overridevirtual |
We redeclare this function only so that the more derived return type is available without casting.
Implements ObjectGroup.
|
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 |
|
overridevirtual |
void expand | ( | const BoundingBox & | box | ) |
box | The other box to use to expand the current one. |
The current bounding box extents are expanded until they fully contain box. It is equivalent to calling expand(const Vector3d&) with the minimum followed by the maximum, but the function here can take advantage of compiler optimizations to make it more efficient than clients making those calls themselves.
bool expand | ( | const Region & | region | ) |
region | The bounding box of the region r will be used to expand the current bounding box. |
The current bounding box extents are expanded until they fully contain the bounding box of the specified region.
void expand | ( | const Vector3d & | p | ) |
p | The point to test against the bounding box. |
If p is not within the current bounding box, the box will be expanded to include it. If the bounding box is null at the time of the call, it will be made non-null and will have its minimum and maximum set to p.
minimum | If the function returns true, then at exit this will hold the corner of the bounding box corresponding to the minimum values of X, Y and Z. |
maximum | If the function returns true, then at exit this will hold the corner of the bounding box corresponding to the maximum values of X, Y and Z. |
The bounding box is guaranteed to contain all the regions for which a point passed to contains() will return true. It can be useful as a way of short-circuiting a more expensive test for whether a point is contained in a complex region. How conservative the bounding box is will be determined entirely by the subclass. It is allowable for the subclass to return the entire 3D domain as the bounding box (and indeed some subclasses logically have to do this, such as RegionNegate).
Implements Region.
Vector3d getMaximum | ( | ) | const |
Vector3d getMinimum | ( | ) | const |
void intersect | ( | const BoundingBox & | box | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
box | The other box with which to form an intersection. |
The intersection of two bounding boxes is the overlapping region, which is also a box. If either box is null, the intersection is also null. If there is no overlapping region, the result is again null. Otherwise, the result will be the largest box that is contained by both boxes.
boxMin | The minimum of the bounding box with which to form an intersection. |
boxMax | The minimum of the bounding box with which to form an intersection. |
The intersection of two bounding boxes is the overlapping region, which is also a box. If either box is null, the intersection is also null. If there is no overlapping region, the result is again null. Otherwise, the result will be the largest box that is contained by both boxes.
bool isInfinite | ( | ) | const |
Internally, an infinite bounding box is one that has the maximum allowable value for the minimum and maximum of the box. Clients should use this function rather than performing that test for themselves in case the way an infinite box is defined changes.
|
overridevirtual |
|
inline |
bool operator== | ( | const BoundingBox & | b | ) | const |
void setInfinite | ( | ) |
void setMaximum | ( | const Vector3d & | max | ) |
void setMinimum | ( | const Vector3d & | min | ) |
|
overridevirtual |
Visit the specified region processor, invoking the correct processing function. Subclasses will need to override this to invoke the correct function.
Implements Region.