jme.geometry.bounding
Class BoundingLozenge

java.lang.Object
  extended byjme.geometry.bounding.BoundingLozenge
All Implemented Interfaces:
BoundingVolume

public class BoundingLozenge
extends java.lang.Object
implements BoundingVolume

BoundingLozenge is a natural extension of a sphere based on equaldistance (from Eberly). It is the set of all points that are a distance r (where r > 0) from a rectangle with origin P and edge directions E1 and E2.

NOTE: See 3D Game Engine Design. David H. Eberly.

Version:
$Id: BoundingLozenge.java,v 1.4 2003/09/08 20:29:28 mojomonkey Exp $
Author:
Mark Powell

Constructor Summary
BoundingLozenge()
          Constructor instantiates a new BoundingLozenge object.
BoundingLozenge(Rectangle rectangle, float radius)
          Constructor instantiates a new BoundingLozenge object.
 
Method Summary
 float distance(BoundingVolume volume)
           
 void guassianDistribution(Vector[] points)
          guassianDistribution calculates the average of the points, and a covariance matrix to determine the rectangle of the lozenge.
 boolean hasCollision(BoundingVolume volume)
           
 boolean isVisible(Frustum frustum)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoundingLozenge

public BoundingLozenge()
Constructor instantiates a new BoundingLozenge object.


BoundingLozenge

public BoundingLozenge(Rectangle rectangle,
                       float radius)
Constructor instantiates a new BoundingLozenge object. The rectangle and radius that defines the Lozenge is set during this construction.

Parameters:
rectangle - the rectangle that defines the center are of the lozenge.
radius - the radius from the rectangle.
Method Detail

guassianDistribution

public void guassianDistribution(Vector[] points)
guassianDistribution calculates the average of the points, and a covariance matrix to determine the rectangle of the lozenge. The radius is than calculated to best fit all the points.

Parameters:
points - the list of points to contain.

hasCollision

public boolean hasCollision(BoundingVolume volume)
Specified by:
hasCollision in interface BoundingVolume

distance

public float distance(BoundingVolume volume)
Specified by:
distance in interface BoundingVolume

isVisible

public boolean isVisible(Frustum frustum)
Specified by:
isVisible in interface BoundingVolume