net.rim.device.api.math
Class Frustum

java.lang.Object
  extended by net.rim.device.api.math.Frustum

public class Frustum
extends Object

Defines a 3-dimensional frustum.

Since:
BlackBerry API 6.0.0

Constructor Summary
Frustum()
          Constructs the default frustum (corresponds to the identity matrix).
Frustum(Frustum frustum)
          Constructs a new frustum from the given frustum.
Frustum(Matrix4f matrix)
          Constructs a new frustum from the specified view projection matrix.
 
Method Summary
 boolean equals(Object obj)
          Returns true if the specified object is equal to this frustum.
 boolean equals(Frustum frustum)
          Returns true if all elements of the specified frustum are equal to the elements of this frustum.
 void getBottom(Plane bottom)
          Gets the bottom plane of the frustum in the given plane.
 void getCorners(Vector3f[] corners, int offset)
          Gets the corners of the frustum in the specified array.
 void getFar(Plane far)
          Gets the far plane of the frustum in the given plane.
 void getLeft(Plane left)
          Gets the left plane of the frustum in the given plane.
 void getMatrix(Matrix4f matrix)
          Gets the projection matrix corresponding to the frustum in the specified matrix.
 void getNear(Plane near)
          Gets the near plane of the frustum in the given plane.
 void getRight(Plane right)
          Gets the right plane of the frustum in the given plane.
 void getTop(Plane top)
          Gets the top plane of the frustum in the given plane.
 int hashCode()
          Returns a hash code based on the elements of this frustum.
 boolean intersects(Bounds bounds)
          Tests whether this frustum intersects the specified bounding object.
 float intersects(Plane plane)
          Tests whether this frustum intersects the specified plane.
 float intersects(Ray ray)
          Tests whether this frustum intersects the specified ray.
 void set(Frustum frustum)
          Sets this frustum to the specified frustum.
 void set(Matrix4f matrix)
          Sets the frustum to the frustum corresponding to the specified view projection matrix.
 String toString()
          Returns a String representation of this frustum.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 



Constructor Detail

Frustum

public Frustum()
Constructs the default frustum (corresponds to the identity matrix).

Since:
BlackBerry API 6.0.0

Frustum

public Frustum(Matrix4f matrix)
Constructs a new frustum from the specified view projection matrix.

Parameters:
matrix - The view projection matrix to construct the frustum from.
Throws:
NullPointerException - If matrix is null.
Since:
BlackBerry API 6.0.0

Frustum

public Frustum(Frustum frustum)
Constructs a new frustum from the given frustum.

Parameters:
frustum - The frustum to copy.
Throws:
NullPointerException - If frustum is null.
Since:
BlackBerry API 6.0.0


Method Detail

getBottom

public void getBottom(Plane bottom)
Gets the bottom plane of the frustum in the given plane.

Parameters:
bottom - The plane to store the bottom plane in.
Throws:
NullPointerException - If bottom is null.
Since:
BlackBerry API 6.0.0

getCorners

public void getCorners(Vector3f[] corners,
                       int offset)
Gets the corners of the frustum in the specified array.

The corners are stored in the following order: (N-near, F-far, L-left, R-right, B-bottom, T-top) LTN, LBN, RBN, RTN, RTF, RBF, LBF, LTF.

Parameters:
corners - The array to store the corners in.
offset - The offset into the array to start storing corners at.
Throws:
IllegalArgumentException - If offset is negative or if offset + 7 is greater than or equal to corners.length.
NullPointerException - If corners or corners[i] (for any integer 0 <= i < 8) is null.
Since:
BlackBerry API 6.0.0

getFar

public void getFar(Plane far)
Gets the far plane of the frustum in the given plane.

Parameters:
far - The plane to store the far plane in.
Throws:
NullPointerException - If far is null.
Since:
BlackBerry API 6.0.0

getLeft

public void getLeft(Plane left)
Gets the left plane of the frustum in the given plane.

Parameters:
left - The plane to store the left plane in.
Throws:
NullPointerException - If left is null.
Since:
BlackBerry API 6.0.0

getNear

public void getNear(Plane near)
Gets the near plane of the frustum in the given plane.

Parameters:
near - The plane to store the near plane in.
Throws:
NullPointerException - If near is null.
Since:
BlackBerry API 6.0.0

getMatrix

public void getMatrix(Matrix4f matrix)
Gets the projection matrix corresponding to the frustum in the specified matrix.

Parameters:
matrix - The matrix to store the projection matrix in.
Throws:
NullPointerException - If matrix is null.
Since:
BlackBerry API 6.0.0

getRight

public void getRight(Plane right)
Gets the right plane of the frustum in the given plane.

Parameters:
right - The plane to store the right plane in.
Throws:
NullPointerException - If right is null.
Since:
BlackBerry API 6.0.0

getTop

public void getTop(Plane top)
Gets the top plane of the frustum in the given plane.

Parameters:
top - The plane to store the top plane in.
Throws:
NullPointerException - If top is null.
Since:
BlackBerry API 6.0.0

intersects

public boolean intersects(Bounds bounds)
Tests whether this frustum intersects the specified bounding object.

Parameters:
bounds - The bounding object to test intersection with.
Returns:
true if the specified bounding object intersects this frustum; false otherwise.
Throws:
NullPointerException - If bounds is null.
Since:
BlackBerry API 6.0.0

intersects

public float intersects(Plane plane)
Tests whether this frustum intersects the specified plane.

Parameters:
plane - The plane to test intersection with.
Returns:
INTERSECTS_BACK if this frustum is in the negative half-space of the plane, INTERSECTS_FRONT if it is in the positive half-space of the plane; and INTERSECTS_INTERSECTING if it intersects the plane.
Throws:
NullPointerException - If plane is null.
Since:
BlackBerry API 6.0.0

intersects

public float intersects(Ray ray)
Tests whether this frustum intersects the specified ray.

Parameters:
ray - The ray to test intersection with.
Returns:
The distance from the origin of the ray to this frustum or INTERSECTS_NONE if the ray does not intersect this frustum.
Throws:
NullPointerException - If ray is null.
Since:
BlackBerry API 6.0.0

set

public void set(Frustum frustum)
Sets this frustum to the specified frustum.

Parameters:
frustum - The frustum to set to.
Throws:
NullPointerException - If frustum is null.
Since:
BlackBerry API 6.0.0

set

public void set(Matrix4f matrix)
Sets the frustum to the frustum corresponding to the specified view projection matrix.

Parameters:
matrix - The view projection matrix.
Throws:
NullPointerException - If matrix is null.
Since:
BlackBerry API 6.0.0

equals

public boolean equals(Frustum frustum)
Returns true if all elements of the specified frustum are equal to the elements of this frustum.

Parameters:
frustum - The frustum to compare.
Returns:
true if this frustum is equal to frustum; false otherwise.
Throws:
NullPointerException - If frustum is null.
Since:
BlackBerry API 6.0.0

equals

public boolean equals(Object obj)
Returns true if the specified object is equal to this frustum.

Overrides:
equals in class Object
Parameters:
obj - The object to compare.
Returns:
true if this frustum is equal to obj; false otherwise.
Throws:
NullPointerException - If obj is null.
See Also:
Boolean.hashCode(), Hashtable
Since:
BlackBerry API 6.0.0

hashCode

public int hashCode()
Returns a hash code based on the elements of this frustum.

Overrides:
hashCode in class Object
Returns:
The hash code for this frustum.
See Also:
Object.equals(java.lang.Object), Hashtable
Since:
BlackBerry API 6.0.0

toString

public String toString()
Returns a String representation of this frustum.

Overrides:
toString in class Object
Returns:
A String representation of this frustum.
Since:
BlackBerry API 6.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal