org.openmali.spatial.bodies
Class Body

java.lang.Object
  extended by org.openmali.spatial.bodies.Body
All Implemented Interfaces:
BodyInterface
Direct Known Subclasses:
Box, ConvexHull, Sphere

public abstract class Body
extends java.lang.Object
implements BodyInterface

Base class for all geometric Bodies.


Field Summary
protected  float centerX
           
protected  float centerY
           
protected  float centerZ
           
protected  boolean distComputed
           
protected  float maxCenterDist
           
protected  float maxCenterDistSquared
           
 
Constructor Summary
Body()
           
 
Method Summary
<T extends Tuple3f>
T
getCenter(T center)
           
 float getCenterX()
           
 float getCenterY()
           
 float getCenterZ()
           
 float getMaxCenterDistance()
           
 float getMaxCenterDistanceSquared()
           
 void setCenter(float x, float y, float z)
          Sets this Bodie's center.
 void setCenter(Tuple3f center)
          Sets this Bodie's center.
protected  void setMaxCenterDistanceSquared(float maxCenterDistSquared)
          Sets the maximum distance to the Bodie's center (squared).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openmali.spatial.bodies.BodyInterface
combine, combine, combine, combine, combine, contains, contains
 

Field Detail

centerX

protected float centerX

centerY

protected float centerY

centerZ

protected float centerZ

maxCenterDist

protected float maxCenterDist

maxCenterDistSquared

protected float maxCenterDistSquared

distComputed

protected boolean distComputed
Constructor Detail

Body

public Body()
Method Detail

setCenter

public void setCenter(float x,
                      float y,
                      float z)
Sets this Bodie's center.

Parameters:
x -
y -
z -

setCenter

public final void setCenter(Tuple3f center)
Sets this Bodie's center.

Parameters:
x -
y -
z -

getCenterX

public final float getCenterX()
Returns:
the x-coordinate of the center.

getCenterY

public final float getCenterY()
Returns:
the y-coordinate of the center.

getCenterZ

public final float getCenterZ()
Returns:
the z-coordinate of the center.

getCenter

public final <T extends Tuple3f> T getCenter(T center)

setMaxCenterDistanceSquared

protected void setMaxCenterDistanceSquared(float maxCenterDistSquared)
Sets the maximum distance to the Bodie's center (squared). For a sphere this is the (squared) radius.

Parameters:
maxCenterDistSquared -

getMaxCenterDistanceSquared

public final float getMaxCenterDistanceSquared()
Returns:
the maximum distance to the Bodie's center (squared). For a sphere this is the (squared) radius.

getMaxCenterDistance

public final float getMaxCenterDistance()
Returns:
the maximum distance to the Bodie's center. For a sphere this is the radius.