espresso3d.engine.collision.bounding
Class E3DBoundingSphere

java.lang.Object
  extended byespresso3d.engine.base.E3DEngineItem
      extended byespresso3d.engine.renderer.base.E3DRenderable
          extended byespresso3d.engine.collision.bounding.E3DBoundingSphere
All Implemented Interfaces:
E3DBoundingObject

public class E3DBoundingSphere
extends E3DRenderable
implements E3DBoundingObject

Author:
Curt A bounding sphere bounding object

Constructor Summary
E3DBoundingSphere(E3DBoundingSphere toCopyBoundingSphere)
           
E3DBoundingSphere(E3DEngine engine, double radius)
           
 
Method Summary
 void centerAroundParentObject()
          This will automatically set the position of the bounding object to be that of its parent object
 E3DCollision checkLineIntersectionCollision(E3DVector3F startPos, E3DVector3F endPos)
           
 int getBoundingSphereType()
           
 E3DCollisionDetector getCollisionDetector()
          Every bounding object must implement this method that takes a list of E3DLine's and returns the closest collision between any of the lines and the bounding object itself, therefore, it must have a collision detector
 E3DOrientation getOrientation()
          Every bounding object has an orientation (position/rotation).
 E3DCollisionDetectableObject getParentObject()
          Bounding objects need to have an actor that they are bounding
 double getRadius()
           
 double getSize()
          Size of this is 2x the radius
 E3DBoundingObject onGetClone()
          Returns a clone of the bounding object
 void render()
           
 void scale(double scaleAmt)
          Scale the bounding object around its position
 void setBoundingSphereType(int boundingSphereType)
           
 void setParentObject(E3DCollisionDetectableObject parentObject)
          Set the parent object of the bounding object.
 void setRadius(double radius)
           
 void setSize(double size)
          Set the size of hte bounding object.
 
Methods inherited from class espresso3d.engine.renderer.base.E3DRenderable
getBlendMode, getKey, getRenderMode, initCorrectGeometryRenderer, isKeyChanged, setBlendMode, setKeyChanged, setRenderMode
 
Methods inherited from class espresso3d.engine.base.E3DEngineItem
getEngine, setEngine
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

E3DBoundingSphere

public E3DBoundingSphere(E3DEngine engine,
                         double radius)

E3DBoundingSphere

public E3DBoundingSphere(E3DBoundingSphere toCopyBoundingSphere)
Method Detail

render

public void render()
Specified by:
render in interface E3DBoundingObject
Specified by:
render in class E3DRenderable

getRadius

public double getRadius()
Returns:
Returns the radius.

setRadius

public void setRadius(double radius)
Parameters:
radius - The radius to set.

checkLineIntersectionCollision

public E3DCollision checkLineIntersectionCollision(E3DVector3F startPos,
                                                   E3DVector3F endPos)
Specified by:
checkLineIntersectionCollision in interface E3DBoundingObject
Parameters:
startPos - World coordinate start position
endPos - World coordinate end position
Returns:

centerAroundParentObject

public void centerAroundParentObject()
Description copied from interface: E3DBoundingObject
This will automatically set the position of the bounding object to be that of its parent object

Specified by:
centerAroundParentObject in interface E3DBoundingObject

onGetClone

public E3DBoundingObject onGetClone()
Description copied from interface: E3DBoundingObject
Returns a clone of the bounding object

Specified by:
onGetClone in interface E3DBoundingObject
Returns:

getBoundingSphereType

public int getBoundingSphereType()

setBoundingSphereType

public void setBoundingSphereType(int boundingSphereType)

getCollisionDetector

public E3DCollisionDetector getCollisionDetector()
Description copied from interface: E3DBoundingObject
Every bounding object must implement this method that takes a list of E3DLine's and returns the closest collision between any of the lines and the bounding object itself, therefore, it must have a collision detector

Specified by:
getCollisionDetector in interface E3DBoundingObject
Returns:

getParentObject

public E3DCollisionDetectableObject getParentObject()
Description copied from interface: E3DBoundingObject
Bounding objects need to have an actor that they are bounding

Specified by:
getParentObject in interface E3DBoundingObject
Returns:

setParentObject

public void setParentObject(E3DCollisionDetectableObject parentObject)
Description copied from interface: E3DBoundingObject
Set the parent object of the bounding object. This is normally handled by the engine itself when a bounding object is added to an object (like an actor).

Specified by:
setParentObject in interface E3DBoundingObject
Parameters:
parentObject -

scale

public void scale(double scaleAmt)
Description copied from interface: E3DBoundingObject
Scale the bounding object around its position

Specified by:
scale in interface E3DBoundingObject
Parameters:
scaleAmt -

setSize

public void setSize(double size)
Description copied from interface: E3DBoundingObject
Set the size of hte bounding object. If a boundingsphere, the radius will be set to .5(size). If a boundingbox, width, height, and depth will be size.

Specified by:
setSize in interface E3DBoundingObject
Parameters:
size - Total size of the bounding object

getSize

public double getSize()
Size of this is 2x the radius

Specified by:
getSize in interface E3DBoundingObject
Returns:

getOrientation

public E3DOrientation getOrientation()
Description copied from interface: E3DBoundingObject
Every bounding object has an orientation (position/rotation). This is NOT directly related to its parent objects orientation. IE: its not cumulative, this orientation is the actual orientation of the bounding object in the world.

Specified by:
getOrientation in interface E3DBoundingObject
Returns: