Package com.ardor3d.bounding
Class BoundingVolume
java.lang.Object
com.ardor3d.bounding.BoundingVolume
- All Implemented Interfaces:
Savable
,Serializable
- Direct Known Subclasses:
BoundingBox
,BoundingSphere
,OrientedBoundingBox
- See Also:
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract BoundingVolume
asType
(BoundingVolume.Type newType) Convert this bounding volume to another, given bounding type.abstract BoundingVolume
clone
(BoundingVolume store) clone
creates a new BoundingVolume object containing the same data as this one.abstract void
computeFromPoints
(FloatBuffer points) computeFromPoints
generates a bounding volume that encompasses a collection of points.abstract void
computeFromPrimitives
(MeshData data, int section, int[] indices, int start, int end) abstract boolean
contains
(ReadOnlyVector3 point) determines if a given point is contained within this bounding volume.final double
distanceSquaredTo
(ReadOnlyVector3 point) Find the squared distance from the center of this Bounding Volume to the given point.final double
distanceTo
(ReadOnlyVector3 point) Find the distance from the center of this Bounding Volume to the given point.abstract double
distanceToEdge
(ReadOnlyVector3 point) Find the distance from the nearest edge of this Bounding Volume to the given point.boolean
final ReadOnlyVector3
int
Grabs the checkplane we should check first.Class
<? extends BoundingVolume> abstract double
abstract BoundingVolume.Type
getType()
getType returns the type of bounding volume this is.abstract double
int
hashCode()
abstract boolean
determines if this bounding volume and a second given volume are intersecting.abstract boolean
intersects
(ReadOnlyRay3 ray) determines if a ray intersects 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 box are intersecting.abstract boolean
determines if this bounding volume and a given bounding sphere are intersecting.abstract IntersectionRecord
determines if a ray intersects this bounding volume and if so, where.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
(InputCapsule capsule) void
setCenter
(double x, double y, double z) final void
setCenter
(ReadOnlyVector3 newCenter) final void
setCheckPlane
(int value) Sets the index of the plane that should be first checked during rendering.abstract BoundingVolume
transform
(ReadOnlyTransform transform, BoundingVolume store) transform
alters the location of the bounding volume by a transform.abstract ReadOnlyPlane.Side
whichSide
(ReadOnlyPlane plane) whichSide
returns the side on which the bounding volume lies on a plane.void
write
(OutputCapsule capsule)
-
Field Details
-
_checkPlane
protected int _checkPlane -
_center
-
_compVect1
-
_compVect2
-
-
Constructor Details
-
BoundingVolume
public BoundingVolume() -
BoundingVolume
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
getCheckPlane
public int getCheckPlane()Grabs the checkplane we should check first.- Returns:
- the index of the plane that should be first checked during rendering
-
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 that should be first checked during rendering
-
getType
getType returns the type of bounding volume this is.- Returns:
- the type of bounding volume
-
transform
transform
alters the location of the bounding volume by a transform.- Parameters:
transform
- the transformstore
- the bounding volume used as a store- Returns:
- the transformed bounding volume
-
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
-
getRadius
public abstract double getRadius()- Returns:
- the distance from the center of this bounding volume to its further edge/corner. Similar to converting this BoundingVolume to a sphere and asking for radius.
-
getCenter
-
setCenter
-
setCenter
public void setCenter(double x, double y, double 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.
-
intersectsWhere
determines if a ray intersects this bounding volume and if so, where.- Parameters:
ray
- the ray to test.- Returns:
- an IntersectionRecord containing information about any intersections made by the given Ray with this bounding
-
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.
-
intersectsOrientedBoundingBox
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.- Parameters:
point
- the point to check- Returns:
- true if the point lies within this bounding volume.
-
asType
Convert this bounding volume to another, given bounding type.- Parameters:
newType
- the type of bounding volume to convert to.- Returns:
- a new bounding volume of the given type, containing this bounding volume.
-
write
- Specified by:
write
in interfaceSavable
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Throws:
IOException
-
getClassTag
- Specified by:
getClassTag
in interfaceSavable
-
computeFromPrimitives
public abstract void computeFromPrimitives(MeshData data, int section, int[] indices, int start, int end) -
getVolume
public abstract double getVolume()
-