|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjme.geometry.bounding.BoundingSphere
BoundingSphere
defines a sphere that defines a container
for a group of vertices of a particular piece of geometry. This sphere
defines a radius and a center. This origin is translated from the containing
entity's position.
A typical usage is to allow the class define the center and radius
by calling either containAABB
or averagePoints
.
Constructor Summary | |
BoundingSphere()
Default contstructor instantiates a new BoundingSphere
object. |
|
BoundingSphere(float radius,
Vector center)
Constructor instantiates a new BoundingSphere object. |
Method Summary | |
void |
averagePoints(Vector[] points)
averagePoints selects the sphere center to be
the average of the points and the sphere radius to be the
smallest value to enclose all points. |
void |
containAABB(Vector[] points)
containAABB creates a minimum-volume axis-aligned
bounding box of the points, then selects the smallest
enclosing sphere of the box with the sphere centered at the
boxes center. |
float |
distance(BoundingVolume volume)
|
Vector |
getCenter()
getCenter returns the center of the bounding sphere. |
float |
getRadius()
getRadius returns the radius of the bounding sphere. |
boolean |
hasCollision(BoundingVolume volume)
|
boolean |
isVisible(Frustum frustum)
|
void |
setCenter(Vector center)
setCenter sets the center of the bounding sphere. |
void |
setRadius(float radius)
setRadius sets the radius of this bounding sphere. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BoundingSphere()
BoundingSphere
object.
public BoundingSphere(float radius, Vector center)
BoundingSphere
object.
radius
- the radius of the sphere.center
- the center of the sphere.Method Detail |
public float getRadius()
getRadius
returns the radius of the bounding sphere.
public Vector getCenter()
getCenter
returns the center of the bounding sphere.
public void setRadius(float radius)
setRadius
sets the radius of this bounding sphere.
radius
- the new radius of the bounding sphere.public void setCenter(Vector center)
setCenter
sets the center of the bounding sphere.
center
- the new center of the bounding sphere.public void containAABB(Vector[] points)
containAABB
creates a minimum-volume axis-aligned
bounding box of the points, then selects the smallest
enclosing sphere of the box with the sphere centered at the
boxes center.
points
- the list of points.public void averagePoints(Vector[] points)
averagePoints
selects the sphere center to be
the average of the points and the sphere radius to be the
smallest value to enclose all points.
points
- the list of points to contain.public boolean hasCollision(BoundingVolume volume)
hasCollision
in interface BoundingVolume
public float distance(BoundingVolume volume)
distance
in interface BoundingVolume
public boolean isVisible(Frustum frustum)
isVisible
in interface BoundingVolume
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |