Package com.jme3.bounding
Class BoundingVolume
java.lang.Object
com.jme3.bounding.BoundingVolume
- All Implemented Interfaces:
Collidable
,Savable
,Cloneable
- Direct Known Subclasses:
BoundingBox
,BoundingSphere
BoundingVolume
defines an interface for dealing with
containment of a collection of points.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The type of bounding volume being used. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
abstract BoundingVolume
clone
(BoundingVolume store) clone
creates a new BoundingVolume object containing the same data as this one.int
collideWith
(Collidable other) abstract void
computeFromPoints
(FloatBuffer points) computeFromPoints
generates a bounding volume that encompasses a collection of points.abstract boolean
determines if a given point is contained within this bounding volume.final float
distanceSquaredTo
(Vector3f point) Find the squared distance from the center of this Bounding Volume to the given point.final float
distanceTo
(Vector3f point) Find the distance from the center of this Bounding Volume to the given point.abstract float
distanceToEdge
(Vector3f point) Find the distance from the nearest edge of this Bounding Volume to the given point.boolean
Tests for exact equality with the argument, distinguishing -0 from 0.final Vector3f
final Vector3f
int
Grabs the plane we should check first.abstract BoundingVolume.Type
getType()
getType returns the type of bounding volume this is.abstract float
int
hashCode()
Returns a hash code.abstract boolean
determines if this bounding volume and a second given volume are intersecting.abstract boolean
intersects
(Ray ray) determines if a ray intersects this bounding volume.abstract boolean
intersects
(Vector3f point) Determines if a given point intersects (touches or is inside) this bounding volume.abstract boolean
determines if this bounding volume and a given bounding box are intersecting.abstract boolean
determines if this bounding volume and a given bounding sphere are intersecting.abstract BoundingVolume
merge
(BoundingVolume volume) merge
combines two bounding volumes into a single bounding volume that contains both this bounding volume and the parameter volume.abstract BoundingVolume
mergeLocal
(BoundingVolume volume) mergeLocal
combines two bounding volumes into a single bounding volume that contains both this bounding volume and the parameter volume.void
read
(JmeImporter importer) final void
setCenter
(float x, float y, float z) final void
final void
setCheckPlane
(int value) Sets the index of the plane that should be first checked during rendering.abstract BoundingVolume
transform
(Matrix4f trans, BoundingVolume store) final BoundingVolume
transform
alters the location of the bounding volume by a rotation, translation and a scalar.abstract BoundingVolume
transform
(Transform trans, BoundingVolume store) transform
alters the location of the bounding volume by a rotation, translation and a scalar.abstract Plane.Side
whichSide
returns the side on which the bounding volume lies on a plane.void
write
(JmeExporter e) Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jme3.collision.Collidable
collideWith
-
Field Details
-
checkPlane
protected int checkPlane -
center
-
-
Constructor Details
-
BoundingVolume
public BoundingVolume() -
BoundingVolume
-
-
Method Details
-
getCheckPlane
public int getCheckPlane()Grabs the plane we should check first.- Returns:
- the index of the plane to be checked first
-
setCheckPlane
public final void setCheckPlane(int value) Sets the index of the plane that should be first checked during rendering.- Parameters:
value
- the index of the plane to be checked first
-
getType
getType returns the type of bounding volume this is.- Returns:
- an enum value
-
transform
transform
alters the location of the bounding volume by a rotation, translation and a scalar.- Parameters:
trans
- the transform to affect the bound.- Returns:
- the new bounding volume.
-
transform
transform
alters the location of the bounding volume by a rotation, translation and a scalar.- Parameters:
trans
- the transform to affect the bound.store
- bounding volume to store result in- Returns:
- the new bounding volume.
-
transform
-
whichSide
whichSide
returns the side on which the bounding volume lies on a plane. Possible values are POSITIVE_SIDE, NEGATIVE_SIDE, and NO_SIDE.- Parameters:
plane
- the plane to check against this bounding volume.- Returns:
- the side on which this bounding volume lies.
-
computeFromPoints
computeFromPoints
generates a bounding volume that encompasses a collection of points.- Parameters:
points
- the points to contain.
-
merge
merge
combines two bounding volumes into a single bounding volume that contains both this bounding volume and the parameter volume.- Parameters:
volume
- the volume to combine.- Returns:
- the new merged bounding volume.
-
mergeLocal
mergeLocal
combines two bounding volumes into a single bounding volume that contains both this bounding volume and the parameter volume. The result is stored locally.- Parameters:
volume
- the volume to combine.- Returns:
- this
-
clone
clone
creates a new BoundingVolume object containing the same data as this one.- Parameters:
store
- where to store the cloned information. if null or wrong class, a new store is created.- Returns:
- the new BoundingVolume
-
equals
Tests for exact equality with the argument, distinguishing -0 from 0. Ifother
is null, false is returned. Either way, the current instance is unaffected. -
hashCode
public int hashCode()Returns a hash code. If two bounding volumes have identical values, they will have the same hash code. The current instance is unaffected. -
getCenter
-
getCenter
-
setCenter
-
setCenter
public final void setCenter(float x, float y, float z) -
distanceTo
Find the distance from the center of this Bounding Volume to the given point.- Parameters:
point
- The point to get the distance to- Returns:
- distance
-
distanceSquaredTo
Find the squared distance from the center of this Bounding Volume to the given point.- Parameters:
point
- The point to get the distance to- Returns:
- distance
-
distanceToEdge
Find the distance from the nearest edge of this Bounding Volume to the given point.- Parameters:
point
- The point to get the distance to- Returns:
- distance
-
intersects
determines if this bounding volume and a second given volume are intersecting. Intersecting being: one volume contains another, one volume overlaps another or one volume touches another.- Parameters:
bv
- the second volume to test against.- Returns:
- true if this volume intersects the given volume.
-
intersects
determines if a ray intersects this bounding volume.- Parameters:
ray
- the ray to test.- Returns:
- true if this volume is intersected by a given ray.
-
intersectsSphere
determines if this bounding volume and a given bounding sphere are intersecting.- Parameters:
bs
- the bounding sphere to test against.- Returns:
- true if this volume intersects the given bounding sphere.
-
intersectsBoundingBox
determines if this bounding volume and a given bounding box are intersecting.- Parameters:
bb
- the bounding box to test against.- Returns:
- true if this volume intersects the given bounding box.
-
contains
determines if a given point is contained within this bounding volume. If the point is on the edge of the bounding volume, this method will return false. Use intersects(Vector3f) to check for edge intersection.- Parameters:
point
- the point to check- Returns:
- true if the point lies within this bounding volume.
-
intersects
Determines if a given point intersects (touches or is inside) this bounding volume.- Parameters:
point
- the point to check- Returns:
- true if the point lies within this bounding volume.
-
getVolume
public abstract float getVolume() -
clone
-
write
- Specified by:
write
in interfaceSavable
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Throws:
IOException
-
collideWith
-