|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jme.scene.Spatial
com.jme.scene.Geometry
com.jme.scene.TriMesh
com.jme.scene.shape.Sphere
com.jme.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.
A typical usage is to allow the class define the center and radius by calling
either containAABB or averagePoints. A call to
computeFramePoint in turn calls containAABB.
| Field Summary | |
int[] |
checkPlanes
|
| Fields inherited from class com.jme.scene.shape.Sphere |
center, radius |
| Fields inherited from class com.jme.scene.TriMesh |
indices, triangleQuantity |
| Fields inherited from class com.jme.scene.Geometry |
bound, color, colorBuf, normal, normBuf, texBuf, texture, vertBuf, vertex, vertQuantity |
| Fields inherited from class com.jme.scene.Spatial |
currentStates, defaultStateList, forceCull, forceView, frustrumIntersects, geometricalControllers, lightCombineMode, localRotation, localScale, localTranslation, name, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder |
| Constructor Summary | |
BoundingSphere()
Default contstructor instantiates a new BoundingSphere
object. |
|
BoundingSphere(float radius,
Vector3f center)
Constructor instantiates a new BoundingSphere object. |
|
BoundingSphere(java.lang.String name,
float radius,
Vector3f center)
Constructor instantiates a new BoundingSphere object. |
|
| Method Summary | |
void |
averagePoints(Vector3f[] 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 |
calcWelzl(Vector3f[] points)
Calculates a minimum bounding sphere for the set of points. |
java.lang.Object |
clone(BoundingVolume store)
clone creates a new BoundingSphere object containing the
same data as this one. |
void |
computeFromPoints(Vector3f[] points)
computeFromPoints creates a new Bounding Sphere from a
given set of points. |
float |
distanceTo(Vector3f point)
Find the distance from the center of this Bounding Volume to the given point. |
Vector3f |
getCenter()
getCenter returns the center of the bounding sphere. |
Vector3f |
getCenter(Vector3f store)
Stores the current center of this BoundingSphere into the store vector. |
int |
getCheckPlane(int index)
getCheckPlane returns a specific check plane. |
float |
getRadius()
getRadius returns the radius of the bounding sphere. |
void |
initCheckPlanes()
initCheckPlanes resets the checkplanes to their standard
order. |
boolean |
intersects(BoundingVolume bv)
determines if this bounding volume and a second given volume are intersecting. |
boolean |
intersects(Ray ray)
determines if a ray intersects this bounding volume. |
boolean |
intersectsBoundingBox(BoundingBox bb)
determines if this bounding volume and a given bounding box are intersecting. |
boolean |
intersectsOBB2(OBB2 obb)
determines if this bounding volume and a given oriented bounding box are intersecting. |
boolean |
intersectsOrientedBoundingBox(OrientedBoundingBox obb)
determines if this bounding volume and a given oriented bounding box are intersecting. |
boolean |
intersectsSphere(BoundingSphere bs)
determines if this bounding volume and a given bounding sphere are intersecting. |
BoundingVolume |
merge(BoundingVolume volume)
merge combines this sphere with a second bounding sphere. |
BoundingVolume |
mergeLocal(BoundingVolume volume)
mergeLocal combines this sphere with a second bounding
sphere locally. |
void |
recomputeMesh()
recomputeMesh regenerates the BoundingSphere
based on new model information. |
void |
setCenter(Vector3f center)
setCenter sets the center of the bounding sphere. |
void |
setCheckPlane(int index,
int value)
setCheckPlane indentifies the value of one of the spheres
checked planes. |
void |
setRadius(float radius)
setRadius sets the radius of this bounding sphere. |
java.lang.String |
toString()
toString returns the string representation of this object. |
BoundingVolume |
transform(Quaternion rotate,
Vector3f translate,
Vector3f scale)
transform modifies the center of the sphere to reflect the
change made via a rotation, translation and scale. |
BoundingVolume |
transform(Quaternion rotate,
Vector3f translate,
Vector3f scale,
BoundingVolume store)
transform modifies the center of the sphere to reflect the
change made via a rotation, translation and scale. |
int |
whichSide(Plane plane)
whichSide takes a plane (typically provided by a view
frustum) to determine which side this bound is on. |
| Methods inherited from class com.jme.scene.shape.Sphere |
setData |
| Methods inherited from class com.jme.scene.TriMesh |
clearBuffers, draw, drawBounds, findCollisions, findTriangleCollision, findTrianglePick, findWorldRotMat, getIndexAsBuffer, getIndices, getMeshAsTriangles, getTriangle, getTriangle, getTriangleQuantity, hasCollision, hasTriangleCollision, putClone, reconstruct, setIndexBuffer, setIndices, updateCollisionTree, updateIndexBuffer |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public int[] checkPlanes
| Constructor Detail |
public BoundingSphere()
BoundingSphere
object.
public BoundingSphere(float radius,
Vector3f center)
BoundingSphere object.
radius - the radius of the sphere.center - the center of the sphere.
public BoundingSphere(java.lang.String name,
float radius,
Vector3f center)
BoundingSphere object.
radius - the radius of the sphere.center - the center of the sphere.| Method Detail |
public void initCheckPlanes()
BoundingVolumeinitCheckPlanes resets the checkplanes to their standard
order.
initCheckPlanes in interface BoundingVolumepublic float getRadius()
getRadius returns the radius of the bounding sphere.
public Vector3f getCenter()
getCenter returns the center of the bounding sphere.
getCenter in class Spherepublic void setRadius(float radius)
setRadius sets the radius of this bounding sphere.
radius - the new radius of the bounding sphere.public void setCenter(Vector3f center)
setCenter sets the center of the bounding sphere.
setCenter in class Spherecenter - the new center of the bounding sphere.Sphere.setData(com.jme.math.Vector3f, int, int, float, boolean)public void computeFromPoints(Vector3f[] points)
computeFromPoints creates a new Bounding Sphere from a
given set of points. It uses the containAABB method as
default.
computeFromPoints in interface BoundingVolumepoints - the points to contain.public void calcWelzl(Vector3f[] points)
points - The points to calculate the minimum bounds from.public void averagePoints(Vector3f[] 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 BoundingVolume transform(Quaternion rotate,
Vector3f translate,
Vector3f scale)
transform modifies the center of the sphere to reflect the
change made via a rotation, translation and scale.
transform in interface BoundingVolumerotate - the rotation change.translate - the translation change.scale - the size change.
public BoundingVolume transform(Quaternion rotate,
Vector3f translate,
Vector3f scale,
BoundingVolume store)
transform modifies the center of the sphere to reflect the
change made via a rotation, translation and scale.
transform in interface BoundingVolumerotate - the rotation change.translate - the translation change.scale - the size change.store - sphere to store result in
public int whichSide(Plane plane)
whichSide takes a plane (typically provided by a view
frustum) to determine which side this bound is on.
whichSide in interface BoundingVolumeplane - the plane to check against.
Pointpublic BoundingVolume merge(BoundingVolume volume)
merge combines this sphere with a second bounding sphere.
This new sphere contains both bounding spheres and is returned.
merge in interface BoundingVolumevolume - the sphere to combine with this sphere.
public BoundingVolume mergeLocal(BoundingVolume volume)
mergeLocal combines this sphere with a second bounding
sphere locally. Altering this sphere to contain both the original and the
additional sphere volumes;
mergeLocal in interface BoundingVolumevolume - the sphere to combine with this sphere.
public java.lang.Object clone(BoundingVolume store)
clone creates a new BoundingSphere object containing the
same data as this one.
clone in interface BoundingVolumestore - where to store the cloned information. if null or wrong class,
a new store is created.
public int getCheckPlane(int index)
getCheckPlane returns a specific check plane. This plane
identitifies the previous value of the visibility check.
getCheckPlane in interface BoundingVolumeindex -
public void setCheckPlane(int index,
int value)
setCheckPlane indentifies the value of one of the spheres
checked planes. That is what plane of the view frustum has been checked
for intersection.
setCheckPlane in interface BoundingVolumeindex - value - public void recomputeMesh()
recomputeMesh regenerates the BoundingSphere
based on new model information.
recomputeMesh in interface BoundingVolumepublic float distanceTo(Vector3f point)
distanceTo in interface BoundingVolumepoint - The point to get the distance to
public Vector3f getCenter(Vector3f store)
getCenter in interface BoundingVolumestore - The vector to store the center into.
public java.lang.String toString()
toString returns the string representation of this object.
The form is: "Radius: RRR.SSSS Center:
toString in class Spatialpublic boolean intersects(BoundingVolume bv)
BoundingVolume
intersects in interface BoundingVolumebv - the second volume to test against.
public boolean intersectsSphere(BoundingSphere bs)
BoundingVolume
intersectsSphere in interface BoundingVolumebs - the bounding sphere to test against.
public boolean intersectsBoundingBox(BoundingBox bb)
BoundingVolume
intersectsBoundingBox in interface BoundingVolumebb - the bounding box to test against.
public boolean intersectsOrientedBoundingBox(OrientedBoundingBox obb)
BoundingVolume
intersectsOrientedBoundingBox in interface BoundingVolumeobb - the bounding box to test against.
public boolean intersectsOBB2(OBB2 obb)
BoundingVolume
intersectsOBB2 in interface BoundingVolumeobb - the bounding box to test against.
public boolean intersects(Ray ray)
BoundingVolume
intersects in interface BoundingVolumeray - the ray to test.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||