de.rico.engine.geometry.collision
Class BoundingSphere

java.lang.Object
  extended by de.rico.engine.geometry.collision.BoundingSphere
All Implemented Interfaces:
BoundingVolumeIface

public class BoundingSphere
extends java.lang.Object
implements BoundingVolumeIface

This class describes a bounding sphere that can be used for collision detection between meshes or frustum culling.

Author:
Frank Bruns

Constructor Summary
BoundingSphere(AbstractMesh mesh)
           
 
Method Summary
 void draw(javax.media.opengl.GL gl)
          Draws the bounding volume
 Point3D getCenter()
          Returns the center point of the bounding volume
 float getMeshHeight()
          Returns the height of the mesh that is bounded by the bounding volume.
 float getRadius()
          Returns the radius of the sphere.
 boolean isWithinFrustum(ViewingFrustum frustum)
          Determines whether the bounding volume is inside the viewing frustum.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoundingSphere

public BoundingSphere(AbstractMesh mesh)
Method Detail

getMeshHeight

public float getMeshHeight()
Description copied from interface: BoundingVolumeIface
Returns the height of the mesh that is bounded by the bounding volume.

Specified by:
getMeshHeight in interface BoundingVolumeIface
Returns:
height of the mesh

getCenter

public Point3D getCenter()
Description copied from interface: BoundingVolumeIface
Returns the center point of the bounding volume

Specified by:
getCenter in interface BoundingVolumeIface
Returns:
center point of the bounding volume

getRadius

public float getRadius()
Returns the radius of the sphere.

Returns:
radius of the sphere

isWithinFrustum

public boolean isWithinFrustum(ViewingFrustum frustum)
Description copied from interface: BoundingVolumeIface
Determines whether the bounding volume is inside the viewing frustum. If it's not inside the viewing frustum the mesh that is bounded by this bounding volume doesn't need to be drawn anymore.

Specified by:
isWithinFrustum in interface BoundingVolumeIface
Parameters:
frustum - viewing frustum object which is coupled to the camera object

draw

public void draw(javax.media.opengl.GL gl)
Description copied from interface: BoundingVolumeIface
Draws the bounding volume

Specified by:
draw in interface BoundingVolumeIface