com.jme.intersection
Class IntersectionRecord

java.lang.Object
  extended by com.jme.intersection.IntersectionRecord

public class IntersectionRecord
extends java.lang.Object

IntersectionRecord stores needed information for a interesection query between two objects. This includes all points that were intersected, and the distances between these points. Therefore, a 1 to 1 ratio between the distance array and the point array is enforced.


Constructor Summary
IntersectionRecord()
          Instantiates a new IntersectionRecord with no distances or points assigned.
IntersectionRecord(float[] distances, Vector3f[] points)
          Instantiates a new IntersectionRecord defining the distances and points.
 
Method Summary
 float getClosestDistance()
          Returns the smallest distance in the distance array.
 int getClosestPoint()
          Returns the point that has the smallest associated distance value.
 int getFarthestPoint()
          Returns the point that has the largest associated distance value.
 float getIntersectionDistance(int index)
          Returns an intersection distance at a provided index.
 Vector3f getIntersectionPoint(int index)
          Returns an intersection point at a provided index.
 int getQuantity()
          Returns the number of intersections that occured.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntersectionRecord

public IntersectionRecord()
Instantiates a new IntersectionRecord with no distances or points assigned.


IntersectionRecord

public IntersectionRecord(float[] distances,
                          Vector3f[] points)
Instantiates a new IntersectionRecord defining the distances and points. If the size of the distance and point arrays do not match, an exception is thrown.

Parameters:
distances - the distances of this intersection.
points - the points of this intersection.
Method Detail

getQuantity

public int getQuantity()
Returns the number of intersections that occured.

Returns:
the number of intersections that occured.

getIntersectionPoint

public Vector3f getIntersectionPoint(int index)
Returns an intersection point at a provided index.

Parameters:
index - the index of the point to obtain.
Returns:
the point at the index of the array.

getIntersectionDistance

public float getIntersectionDistance(int index)
Returns an intersection distance at a provided index.

Parameters:
index - the index of the distance to obtain.
Returns:
the distance at the index of the array.

getClosestDistance

public float getClosestDistance()
Returns the smallest distance in the distance array.

Returns:
the smallest distance in the distance array.

getClosestPoint

public int getClosestPoint()
Returns the point that has the smallest associated distance value.

Returns:
the point that has the smallest associated distance value.

getFarthestPoint

public int getFarthestPoint()
Returns the point that has the largest associated distance value.

Returns:
the point that has the largest associated distance value.