Package com.ardor3d.intersection
Class IntersectionRecord
java.lang.Object
com.ardor3d.intersection.IntersectionRecord
-
Constructor Summary
ConstructorDescriptionIntersectionRecord
(double[] distances, Vector3[] points) Instantiates a new IntersectionRecord defining the distances and points.IntersectionRecord
(double[] distances, Vector3[] points, Vector3[] normals, List<PrimitiveKey> primitives) Instantiates a new IntersectionRecord defining the distances and points.IntersectionRecord
(double[] distances, Vector3[] points, List<PrimitiveKey> primitives) Instantiates a new IntersectionRecord defining the distances and points. -
Method Summary
Modifier and TypeMethodDescriptiondouble
int
double
int
double
getIntersectionDistance
(int index) Returns an intersection distance at a provided index.getIntersectionNormal
(int index) Returns an intersection normal at a provided index.getIntersectionPoint
(int index) Returns an intersection point at a provided index.getIntersectionPrimitive
(int index) int
void
Sorts intersections from near to far
-
Constructor Details
-
IntersectionRecord
Instantiates a new IntersectionRecord defining the distances and points.- Parameters:
distances
- the distances of this intersection.points
- the points of this intersection.- Throws:
Ardor3dException
- if distances.length != points.length
-
IntersectionRecord
Instantiates a new IntersectionRecord defining the distances and points.- Parameters:
distances
- the distances of this intersection.points
- the points of this intersection.primitives
- the primitives at each index. May be null.- Throws:
Ardor3dException
- if distances.length != points.length or points.length != primitives.size() (if primitives is not null)
-
IntersectionRecord
public IntersectionRecord(double[] distances, Vector3[] points, Vector3[] normals, List<PrimitiveKey> primitives) Instantiates a new IntersectionRecord defining the distances and points.- Parameters:
distances
- the distances of this intersection.points
- the points of this intersection.normals
- the normals of this intersection.primitives
- the primitives at each index. May be null.- Throws:
Ardor3dException
- if distances.length != points.length or points.length != primitives.size() (if primitives is not null)
-
-
Method Details
-
sortIntersections
public void sortIntersections()Sorts intersections from near to far -
getNumberOfIntersections
public int getNumberOfIntersections()- Returns:
- the number of intersections that occurred.
-
getIntersectionPoint
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.
-
getIntersectionNormal
Returns an intersection normal at a provided index.- Parameters:
index
- the index of the point to obtain.- Returns:
- the normal at the index of the array.
-
getIntersectionDistance
public double 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.
-
getIntersectionPrimitive
- Parameters:
index
- the index of the primitive to obtain.- Returns:
- the primitive at the given index.
-
getClosestDistance
public double getClosestDistance()- Returns:
- the smallest distance in the distance array or -1 if there are no distances in this.
-
getFurthestDistance
public double getFurthestDistance()- Returns:
- the largest distance in the distance array or -1 if there are no distances in this.
-
getClosestIntersection
public int getClosestIntersection()- Returns:
- the index in this record with the smallest relative distance or -1 if there are no distances in this record.
-
getFurthestIntersection
public int getFurthestIntersection()- Returns:
- the index in this record with the largest relative distance or -1 if there are no distances in this record.
-