![]() |
Workspace 7.1.0
|
Describes a bounding sphere region in 3D space.
#include <Mesh/Geometry/boundingsphere.h>
Public Member Functions | |
BoundingSphere () | |
BoundingSphere (const BoundingSphere &sphere) | |
BoundingSphere (const Vector3d ¢er, double radius=0) | |
BoundingSphere * | clone () const override |
BoundingSphere * | cloneRegion () const override |
bool | contains (const Vector3d &p) const override |
void | destroy () override |
void | expand (const Vector3d &p) |
void | expandRadius (const Vector3d &p) |
bool | getBoundingBox (Vector3d &minimum, Vector3d &maximum) const override |
bool | getBoundingSphere (Vector3d ¢er, double &radius) const override |
Vector3d | getCenter () const |
double | getRadius () const |
bool | isNull () const override |
bool | operator!= (const BoundingSphere &v) const |
bool | operator== (const BoundingSphere &b) const |
void | setCenter (const Vector3d &c) |
void | setRadius (double r) |
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, const QString &preferredWidget=QString()) |
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 |
QString | getChildPreferredWidget (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, const QString &preferredWidget=QString()) |
bool | load (const QJsonDocument &doc) |
bool | load (const SerializedItem &item) override |
bool | save (QJsonDocument &doc) const |
bool | save (SerializedItem &item) const override |
bool | setChildPreferredWidget (const QString &name, const QString &widget) |
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) |
BoundingSphere | ( | ) |
Constructs a null bounding sphere.
BoundingSphere | ( | const BoundingSphere & | sphere | ) |
sphere | The bounding sphere to copy. |
BoundingSphere | ( | const Vector3d & | center, |
double | radius = 0 |
||
) |
center | The center of the bounding sphere. |
radius | The radius of the bounding sphere. It must not be negative. |
|
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 Vector3d & | p | ) |
p | The point to test against the bounding sphere. |
If p is not within the current bounding sphere, the sphere will be expanded to include it. If the bounding sphere is null at the time of the call, it will be made non-null and will have its center set to p and its radius to zero..
void expandRadius | ( | const Vector3d & | p | ) |
p | The point to test against the bounding sphere. |
If p is not within the current bounding sphere, the sphere's radius will be expanded to include it.
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.
|
overridevirtual |
center | This will hold the center of the bounding sphere if the function is successful. If not successful, the function leaves it unmodified from the passed in value. |
radius | This will hold the radius of the bounding sphere if the function is successful. If not successful, the function leaves it unmodified from the passed in value. |
If the bounding sphere is not null, this function always succeeds and will be very efficient since the center and radius are both already held internally by the object.
Reimplemented from Region.
Vector3d getCenter | ( | ) | const |
double getRadius | ( | ) | const |
|
overridevirtual |
|
inline |
bool operator== | ( | const BoundingSphere & | b | ) | const |
void setCenter | ( | const Vector3d & | c | ) |
c | The new center of the sphere. |
void setRadius | ( | double | r | ) |
r | The new radius of the sphere. |
|
overridevirtual |
Visit the specified region processor, invoking the correct processing function. Subclasses will need to override this to invoke the correct function.
Implements Region.