com.jme.bounding
Class BoundingCapsule

java.lang.Object
  extended by com.jme.bounding.BoundingVolume
      extended by com.jme.bounding.BoundingCapsule
All Implemented Interfaces:
Savable, java.io.Serializable

public class BoundingCapsule
extends BoundingVolume

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jme.bounding.BoundingVolume
BoundingVolume.Type
 
Field Summary
 
Fields inherited from class com.jme.bounding.BoundingVolume
_compVect1, _compVect2, _compVect3, center, checkPlane
 
Constructor Summary
BoundingCapsule()
           
BoundingCapsule(Vector3f center, LineSegment ls, float radius)
           
 
Method Summary
 BoundingVolume clone(BoundingVolume store)
          clone creates a new BoundingVolume object containing the same data as this one.
 void computeFromPoints(java.nio.FloatBuffer points)
          computeFromPoints generates a bounding volume that encompasses a collection of points.
 void computeFromTris(int[] triIndex, TriMesh mesh, int start, int end)
           
 void computeFromTris(Triangle[] tris, int start, int end)
           
 boolean contains(BoundingCapsule capsule)
           
 boolean contains(BoundingSphere sphere)
           
 boolean contains(float sphereRadius, Vector3f sphereCenter)
           
 boolean contains(float radius, Vector3f start, Vector3f end)
           
 boolean contains(Vector3f point)
          determines if a given point is contained within this bounding volume.
 float distanceToEdge(Vector3f point)
          Find the distance from the nearest edge of this Bounding Volume to the given point.
 LineSegment getLineSegment()
           
 float getRadius()
           
 BoundingVolume.Type getType()
          getType returns the type of bounding volume this is.
 float getVolume()
           
 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 intersectsCapsule(BoundingCapsule bc)
          determins if this bounding volume and a given bounding capsule are intersecting.
 boolean intersectsOrientedBoundingBox(OrientedBoundingBox obb)
          determines if this bounding volume and a given bounding box are intersecting.
 boolean intersectsSphere(BoundingSphere bs)
          determines if this bounding volume and a given bounding sphere are intersecting.
 IntersectionRecord intersectsWhere(Ray ray)
          determines if a ray intersects this bounding volume and if so, where.
 BoundingVolume merge(BoundingVolume volume)
          merge combines two bounding volumes into a single bounding volume that contains both this bounding volume and the parameter volume.
 BoundingCapsule mergeCapsule(BoundingCapsule capsule, BoundingCapsule merged)
           
 BoundingVolume mergeLocal(BoundingVolume volume)
          mergeLocal combines two bounding volumes into a single bounding volume that contains both this bounding volume and the parameter volume.
 BoundingCapsule mergeSphere(BoundingSphere sphere, BoundingCapsule merged)
           
 void setLineSegment(LineSegment lineSegment)
           
 void setRadius(float radius)
           
 BoundingVolume transform(Quaternion rotate, Vector3f translate, Vector3f scale, BoundingVolume store)
          transform alters the location of the bounding volume by a rotation, translation and a scalar.
 Plane.Side whichSide(Plane plane)
          whichSide returns the side on which the bounding volume lies on a plane.
 
Methods inherited from class com.jme.bounding.BoundingVolume
distanceSquaredTo, distanceTo, getCenter, getCenter, getCheckPlane, getClassTag, read, setCenter, setCheckPlane, transform, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoundingCapsule

public BoundingCapsule()

BoundingCapsule

public BoundingCapsule(Vector3f center,
                       LineSegment ls,
                       float radius)
Method Detail

clone

public BoundingVolume clone(BoundingVolume store)
Description copied from class: BoundingVolume
clone creates a new BoundingVolume object containing the same data as this one.

Specified by:
clone in class BoundingVolume
Parameters:
store - where to store the cloned information. if null or wrong class, a new store is created.
Returns:
the new BoundingVolume

computeFromPoints

public void computeFromPoints(java.nio.FloatBuffer points)
Description copied from class: BoundingVolume
computeFromPoints generates a bounding volume that encompasses a collection of points.

Specified by:
computeFromPoints in class BoundingVolume
Parameters:
points - the points to contain.

computeFromTris

public void computeFromTris(int[] triIndex,
                            TriMesh mesh,
                            int start,
                            int end)
Specified by:
computeFromTris in class BoundingVolume

computeFromTris

public void computeFromTris(Triangle[] tris,
                            int start,
                            int end)
Specified by:
computeFromTris in class BoundingVolume

contains

public boolean contains(Vector3f point)
Description copied from class: BoundingVolume
determines if a given point is contained within this bounding volume.

Specified by:
contains in class BoundingVolume
Parameters:
point - the point to check
Returns:
true if the point lies within this bounding volume.

contains

public boolean contains(BoundingSphere sphere)

contains

public boolean contains(float sphereRadius,
                        Vector3f sphereCenter)

contains

public boolean contains(BoundingCapsule capsule)

contains

public boolean contains(float radius,
                        Vector3f start,
                        Vector3f end)

distanceToEdge

public float distanceToEdge(Vector3f point)
Description copied from class: BoundingVolume
Find the distance from the nearest edge of this Bounding Volume to the given point.

Specified by:
distanceToEdge in class BoundingVolume
Parameters:
point - The point to get the distance to
Returns:
distance

getType

public BoundingVolume.Type getType()
Description copied from class: BoundingVolume
getType returns the type of bounding volume this is.

Specified by:
getType in class BoundingVolume

intersects

public boolean intersects(BoundingVolume bv)
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 class BoundingVolume
Parameters:
bv - the second volume to test against.
Returns:
true if this volume intersects the given volume.

intersects

public boolean intersects(Ray ray)
Description copied from class: BoundingVolume
determines if a ray intersects this bounding volume.

Specified by:
intersects in class BoundingVolume
Parameters:
ray - the ray to test.
Returns:
true if this volume is intersected by a given ray.

intersectsBoundingBox

public boolean intersectsBoundingBox(BoundingBox bb)
Description copied from class: BoundingVolume
determines if this bounding volume and a given bounding box are intersecting.

Specified by:
intersectsBoundingBox in class BoundingVolume
Parameters:
bb - the bounding box to test against.
Returns:
true if this volume intersects the given bounding box.

intersectsCapsule

public boolean intersectsCapsule(BoundingCapsule bc)
Description copied from class: BoundingVolume
determins if this bounding volume and a given bounding capsule are intersecting.

Specified by:
intersectsCapsule in class BoundingVolume
Parameters:
bc - the bounding capsule to test against.
Returns:
true if this volume instersects the given bounding capsule.

intersectsOrientedBoundingBox

public boolean intersectsOrientedBoundingBox(OrientedBoundingBox obb)
Description copied from class: BoundingVolume
determines if this bounding volume and a given bounding box are intersecting.

Specified by:
intersectsOrientedBoundingBox in class BoundingVolume
Parameters:
obb - the bounding box to test against.
Returns:
true if this volume intersects the given bounding box.

intersectsSphere

public boolean intersectsSphere(BoundingSphere bs)
Description copied from class: BoundingVolume
determines if this bounding volume and a given bounding sphere are intersecting.

Specified by:
intersectsSphere in class BoundingVolume
Parameters:
bs - the bounding sphere to test against.
Returns:
true if this volume intersects the given bounding sphere.

intersectsWhere

public IntersectionRecord intersectsWhere(Ray ray)
Description copied from class: BoundingVolume
determines if a ray intersects this bounding volume and if so, where.

Specified by:
intersectsWhere in class BoundingVolume
Parameters:
ray - the ray to test.
Returns:
an IntersectionRecord containing information about any intersections made by the given Ray with this bounding

merge

public BoundingVolume merge(BoundingVolume volume)
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 class BoundingVolume
Parameters:
volume - the volume to combine.
Returns:
the new merged bounding volume.

mergeSphere

public BoundingCapsule mergeSphere(BoundingSphere sphere,
                                   BoundingCapsule merged)

mergeCapsule

public BoundingCapsule mergeCapsule(BoundingCapsule capsule,
                                    BoundingCapsule merged)

mergeLocal

public BoundingVolume mergeLocal(BoundingVolume volume)
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 class BoundingVolume
Parameters:
volume - the volume to combine.
Returns:
this

transform

public BoundingVolume transform(Quaternion rotate,
                                Vector3f translate,
                                Vector3f scale,
                                BoundingVolume store)
Description copied from class: BoundingVolume
transform alters the location of the bounding volume by a rotation, translation and a scalar.

Specified by:
transform in class BoundingVolume
Parameters:
rotate - the rotation to affect the bound.
translate - the translation to affect the bound.
scale - the scale to resize the bound.
store - sphere to store result in
Returns:
the new bounding volume.

whichSide

public Plane.Side whichSide(Plane plane)
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 class BoundingVolume
Parameters:
plane - the plane to check against this bounding volume.
Returns:
the side on which this bounding volume lies.

getLineSegment

public LineSegment getLineSegment()

setLineSegment

public void setLineSegment(LineSegment lineSegment)

getRadius

public float getRadius()

setRadius

public void setRadius(float radius)

getVolume

public float getVolume()
Specified by:
getVolume in class BoundingVolume