Home | Download | Screen shots | Discussion | Documentation |
---|
A bounding sphere. More...
Public Member Functions | |
bounding_sphere () | |
Construct. | |
virtual | ~bounding_sphere () throw () |
Destroy. | |
void | center (const vec3f &c) |
Set the center coordinates. | |
const vec3f & | center () const |
Get the center coordinates. | |
void | radius (float r) |
Set the radius. | |
float | radius () const |
Get the radius. | |
![]() | |
virtual | ~bounding_volume ()=0 throw () |
Destroy. | |
void | maximize () |
Maximize the bounding volume. | |
bool | maximized () const throw () |
Indicates whether the bounding volume is maximized. | |
intersection | intersect_frustum (const openvrml::frustum &frustum) const |
Intersect this bounding_volume with a frustum . | |
void | extend (const vec3f &p) |
Extend the bounding volume to enclose p . | |
void | extend (const bounding_volume &bv) |
Extend the bounding_volume to enclose bv . | |
void | enclose (const std::vector< vec3f > &points) |
Enclose the given set of points. | |
void | ortho_transform (const mat4f &M) |
Transform this bounding volume using an orthogonal transfom. | |
void | transform (const mat4f &M) |
Transform this bounding volume using an affine transfom. |
Private Member Functions | |
virtual void | do_maximize () |
Extend the bounding sphere to infinity. | |
virtual bool | do_maximized () const |
Whether the bounding_sphere is maximized. | |
virtual intersection | do_intersect_frustum (const openvrml::frustum &frustum) const |
Intersect this bvolume with a frustum. | |
virtual void | do_extend (const vec3f &p) |
Extend to enclose p . | |
virtual void | do_extend (const axis_aligned_bounding_box &bbox) |
Extend the bounding volume to enclose bbox . | |
virtual void | do_extend (const bounding_sphere &b) |
Extend this bvolume to enclose the given sphere. | |
virtual void | do_enclose (const std::vector< vec3f > &points) |
Enclose the given set of points. | |
virtual void | do_ortho_transform (const mat4f &t) |
Orthographically transform the bounding_sphere by t . | |
virtual void | do_transform (const mat4f &t) |
Transform the bounding_sphere by t . |
Private Attributes | |
vec3f | center_ |
The center of the sphere. | |
float | radius_ |
The radius of the sphere. |
Additional Inherited Members | |
![]() | |
enum | intersection { outside = -1, partial = 0, inside = 1 } |
Indicates the type of intersection. More... |
A bounding sphere.
Bounding spheres are very fast to intersect test, but they are fairly loose. If asked to choose just one bounding volume, four out of five graphics professionals surveyed chose the bounding sphere for their patients who chewed bounding volumes.
openvrml::bounding_sphere::bounding_sphere | ( | ) |
Construct.
|
virtual |
Destroy.
void openvrml::bounding_sphere::center | ( | const vec3f & | c | ) |
Set the center coordinates.
[in] | c | new center coordinates. |
const openvrml::vec3f & openvrml::bounding_sphere::center | ( | ) | const |
Get the center coordinates.
void openvrml::bounding_sphere::radius | ( | float | r | ) |
Set the radius.
[in] | r | new radius value. |
float openvrml::bounding_sphere::radius | ( | ) | const |
Get the radius.
|
privatevirtual |
Extend the bounding sphere to infinity.
|
privatevirtual |
Whether the bounding_sphere is maximized.
true
if the bounding_sphere has been maximized; false
otherwise.
|
privatevirtual |
Intersect this bvolume with a frustum.
The test assumes that the frustum is in the canonical looking-down-negative-z orientation, so the bounding volume is going to have to be transformed into the frustum's space. (Alternatives include transforming the frustum into the bounding volume's space, or transforming both of them into the projection space. Lots of tradeoffs involved, but transforming the bounding volume is probably the simplest approach overall.)
[in] | frustum | the frustum. |
|
privatevirtual |
Extend to enclose p
.
[in] | p | a point. |
|
privatevirtual |
Extend the bounding volume to enclose bbox
.
[in] | bbox | an axis-aligned bounding box |
|
privatevirtual |
Extend this bvolume to enclose the given sphere.
[in] | b | a bounding sphere |
|
privatevirtual |
Enclose the given set of points.
This resets the volume from any previous values.
[in] | points | points. |
|
privatevirtual |
Orthographically transform the bounding_sphere by t
.
[in] | t | transformation matrix. |
|
privatevirtual |
Transform the bounding_sphere by t
.
[in] | t | transformation matrix. |
|
private |
The center of the sphere.
|
private |
The radius of the sphere.