Package com.ardor3d.bounding
Class OrientedBoundingBox
java.lang.Object
com.ardor3d.bounding.BoundingVolume
com.ardor3d.bounding.OrientedBoundingBox
- All Implemented Interfaces:
Savable
,Serializable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.ardor3d.bounding.BoundingVolume
BoundingVolume.Type
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Vector3
protected final Vector3
Extents of the box along the x,y,z axis.protected final Vector3[]
Vector array used to store the array of 8 corners the box has.protected final Vector3
X axis of the Oriented Box.protected final Vector3
Y axis of the Oriented Box.protected final Vector3
Z axis of the Oriented Box.boolean
If true, the box's vectorStore array correctly represents the box's corners.Fields inherited from class com.ardor3d.bounding.BoundingVolume
_center, _checkPlane, _compVect1, _compVect2
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionasType
(BoundingVolume.Type newType) Convert this bounding volume to another, given bounding type.clone
(BoundingVolume store) clone
creates a new BoundingVolume object containing the same data as this one.void
Sets the vectorStore information to the 8 corners of the box.void
computeFromPoints
(FloatBuffer points) computeFromPoints
generates a bounding volume that encompasses a collection of points.void
computeFromPrimitives
(MeshData data, int section, int[] indices, int start, int end) boolean
contains
(ReadOnlyVector3 point) determines if a given point is contained within this bounding volume.double
distanceToEdge
(ReadOnlyVector3 point) Find the distance from the nearest edge of this Bounding Volume to the given point.boolean
double
getType()
getType returns the type of bounding volume this is.double
getXAxis()
getYAxis()
getZAxis()
int
hashCode()
boolean
boolean
determines if this bounding volume and a second given volume are intersecting.boolean
intersects
(ReadOnlyRay3 ray) determines if a ray intersects this bounding volume.boolean
determines if this bounding volume and a given bounding box are intersecting.boolean
determines if this bounding volume and a given bounding box are intersecting.boolean
determines if this bounding volume and a given bounding sphere are intersecting.determines if a ray intersects this bounding volume and if so, where.merge
(BoundingVolume volume) merge
combines two bounding volumes into a single bounding volume that contains both this bounding volume and the parameter volume.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
setExtent
(ReadOnlyVector3 ext) void
setXAxis
(ReadOnlyVector3 axis) void
setYAxis
(ReadOnlyVector3 axis) void
setZAxis
(ReadOnlyVector3 axis) transform
(ReadOnlyTransform transform, BoundingVolume store) transform
alters the location of the bounding volume by a transform.whichSide
(ReadOnlyPlane plane) whichSide
returns the side on which the bounding volume lies on a plane.void
write
(OutputCapsule capsule) Methods inherited from class com.ardor3d.bounding.BoundingVolume
distanceSquaredTo, distanceTo, getCenter, getCheckPlane, getClassTag, setCenter, setCenter, setCheckPlane
-
Field Details
-
_xAxis
X axis of the Oriented Box. -
_yAxis
Y axis of the Oriented Box. -
_zAxis
Z axis of the Oriented Box. -
_extent
Extents of the box along the x,y,z axis. -
_vectorStore
Vector array used to store the array of 8 corners the box has. -
correctCorners
public boolean correctCornersIf true, the box's vectorStore array correctly represents the box's corners. -
_compVect3
-
-
Constructor Details
-
OrientedBoundingBox
public OrientedBoundingBox()
-
-
Method Details
-
hashCode
public int hashCode()- Overrides:
hashCode
in classBoundingVolume
-
equals
- Overrides:
equals
in classBoundingVolume
-
getType
Description copied from class:BoundingVolume
getType returns the type of bounding volume this is.- Specified by:
getType
in classBoundingVolume
- Returns:
- the type of bounding volume
-
transform
Description copied from class:BoundingVolume
transform
alters the location of the bounding volume by a transform.- Specified by:
transform
in classBoundingVolume
- Parameters:
transform
- the transformstore
- the bounding volume used as a store- Returns:
- the transformed bounding volume
-
whichSide
Description copied from class:BoundingVolume
whichSide
returns the side on which the bounding volume lies on a plane. Possible values are POSITIVE_SIDE, NEGATIVE_SIDE, and NO_SIDE.- Specified by:
whichSide
in classBoundingVolume
- Parameters:
plane
- the plane to check against this bounding volume.- Returns:
- the side on which this bounding volume lies.
-
computeFromPoints
Description copied from class:BoundingVolume
computeFromPoints
generates a bounding volume that encompasses a collection of points.- Specified by:
computeFromPoints
in classBoundingVolume
- Parameters:
points
- the points to contain.
-
merge
Description copied from class:BoundingVolume
merge
combines two bounding volumes into a single bounding volume that contains both this bounding volume and the parameter volume.- Specified by:
merge
in classBoundingVolume
- Parameters:
volume
- the volume to combine.- Returns:
- the new merged bounding volume.
-
mergeLocal
Description copied from class:BoundingVolume
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.- Specified by:
mergeLocal
in classBoundingVolume
- Parameters:
volume
- the volume to combine.- Returns:
- this
-
asType
Description copied from class:BoundingVolume
Convert this bounding volume to another, given bounding type.- Specified by:
asType
in classBoundingVolume
- Parameters:
newType
- the type of bounding volume to convert to.- Returns:
- a new bounding volume of the given type, containing this bounding volume.
-
clone
Description copied from class:BoundingVolume
clone
creates a new BoundingVolume object containing the same data as this one.- Specified by:
clone
in classBoundingVolume
- Parameters:
store
- where to store the cloned information. if null or wrong class, a new store is created.- Returns:
- the new BoundingVolume
-
getRadius
public double getRadius()- Specified by:
getRadius
in classBoundingVolume
- 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.
-
computeCorners
public void computeCorners()Sets the vectorStore information to the 8 corners of the box. -
computeFromPrimitives
- Specified by:
computeFromPrimitives
in classBoundingVolume
-
intersection
-
intersects
Description copied from class:BoundingVolume
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.- Specified by:
intersects
in classBoundingVolume
- Parameters:
bv
- the second volume to test against.- Returns:
- true if this volume intersects the given volume.
-
intersectsSphere
Description copied from class:BoundingVolume
determines if this bounding volume and a given bounding sphere are intersecting.- Specified by:
intersectsSphere
in classBoundingVolume
- Parameters:
bs
- the bounding sphere to test against.- Returns:
- true if this volume intersects the given bounding sphere.
-
intersectsBoundingBox
Description copied from class:BoundingVolume
determines if this bounding volume and a given bounding box are intersecting.- Specified by:
intersectsBoundingBox
in classBoundingVolume
- Parameters:
bb
- the bounding box to test against.- Returns:
- true if this volume intersects the given bounding box.
-
intersectsOrientedBoundingBox
Description copied from class:BoundingVolume
determines if this bounding volume and a given bounding box are intersecting.- Specified by:
intersectsOrientedBoundingBox
in classBoundingVolume
- Parameters:
obb
- the bounding box to test against.- Returns:
- true if this volume intersects the given bounding box.
-
intersects
Description copied from class:BoundingVolume
determines if a ray intersects this bounding volume.- Specified by:
intersects
in classBoundingVolume
- Parameters:
ray
- the ray to test.- Returns:
- true if this volume is intersected by a given ray.
-
intersectsWhere
Description copied from class:BoundingVolume
determines if a ray intersects this bounding volume and if so, where.- Specified by:
intersectsWhere
in classBoundingVolume
- Parameters:
ray
- the ray to test.- Returns:
- an IntersectionRecord containing information about any intersections made by the given Ray with this bounding
-
setXAxis
-
setYAxis
-
setZAxis
-
setExtent
-
getXAxis
-
getYAxis
-
getZAxis
-
getExtent
-
contains
Description copied from class:BoundingVolume
determines if a given point is contained within this bounding volume.- Specified by:
contains
in classBoundingVolume
- Parameters:
point
- the point to check- Returns:
- true if the point lies within this bounding volume.
-
distanceToEdge
Description copied from class:BoundingVolume
Find the distance from the nearest edge of this Bounding Volume to the given point.- Specified by:
distanceToEdge
in classBoundingVolume
- Parameters:
point
- The point to get the distance to- Returns:
- distance
-
write
- Specified by:
write
in interfaceSavable
- Overrides:
write
in classBoundingVolume
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Overrides:
read
in classBoundingVolume
- Throws:
IOException
-
getVolume
public double getVolume()- Specified by:
getVolume
in classBoundingVolume
-