|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.math.Plane
public class Plane
Defines a 3-dimensional plane.
This class guarantees that the normal vector of the plane is always normalized. (The plane's distance is the distance to the origin along the normal vector once the normal vector is normalized.)
Field Summary | ||
---|---|---|
static float |
INTERSECTS_BACK
Represents when a 3d entity is behind (in the negative half-space of) a plane. |
|
static float |
INTERSECTS_FRONT
Represents when a 3d entity is in front of (in the positive half-space of) a plane. |
|
static float |
INTERSECTS_INTERSECTING
Represents when a 3d entity intersects a plane. |
Constructor Summary | ||
---|---|---|
Plane(Plane plane)
Constructs a new plane from the given plane. |
||
Plane(Vector3f normal,
float distance)
Constructs a new plane from the specified values. |
Method Summary | ||
---|---|---|
float |
distance(Vector3f point)
Calculates the distance from this plane to the specified point. |
|
boolean |
equals(Object obj)
Determines if the specified object is of type Plane and all of its elements are equal to the elements of this plane. |
|
boolean |
equals(Plane plane)
Returns true if all elements of the specified plane are equal to the elements of this plane. |
|
float |
getDistance()
Gets the plane's distance to the origin along its normal. |
|
void |
getNormal(Vector3f normal)
Gets the plane's normal in the given vector. |
|
int |
hashCode()
Returns a hash code based on the elements of this plane. |
|
static void |
intersection(Plane p1,
Plane p2,
Plane p3,
Vector3f point)
Calculates the point of intersection of the given three planes and stores it in the given point. |
|
float |
intersects(Bounds bounds)
Tests whether this plane intersects the specified bounds. |
|
float |
intersects(Frustum frustum)
Tests whether this plane intersects the specified frustum. |
|
float |
intersects(Plane plane)
Tests whether this plane intersects the specified plane. |
|
float |
intersects(Ray ray)
Tests whether this plane intersects the specified ray. |
|
void |
set(Plane plane)
Sets this plane to the given plane. |
|
void |
set(Vector3f normal,
float distance)
Sets this plane to the specified values. |
|
void |
setDistance(float distance)
Sets the plane's distance to the origin along its normal. |
|
void |
setNormal(float nx,
float ny,
float nz)
Sets the plane's normal to the given values. |
|
void |
setNormal(Vector3f normal)
Sets the plane's normal to the given vector. |
|
String |
toString()
Returns a String representation of this plane. |
|
void |
transform(Matrix4f matrix)
Transforms this plane by the given transformation matrix. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final float INTERSECTS_BACK
public static final float INTERSECTS_FRONT
public static final float INTERSECTS_INTERSECTING
Constructor Detail |
---|
public Plane(Vector3f normal, float distance)
normal
- The normal vector of this plane.distance
- The distance to this plane along its (unit) normal to the origin.
Note that if the normal vector is not a unit vector then the distance will be normalized.
IllegalArgumentException
- If normal
is the zero vector.
NullPointerException
- If normal
is null
.public Plane(Plane plane)
plane
- The plane to copy.
NullPointerException
- If plane
is null
.Method Detail |
---|
public float distance(Vector3f point)
point
- The point to calculate distance to.
NullPointerException
- If point
is null
.public float getDistance()
public void getNormal(Vector3f normal)
normal
- The vector to store the plane's normal in.
NullPointerException
- If normal
is null
.public static void intersection(Plane p1, Plane p2, Plane p3, Vector3f point)
p1
- The first plane.p2
- The second plane.p3
- The third plane.point
- The point to store the point of intersection in
(this is left unmodified if the planes do not all intersect or if
they are all parallel along one vector and intersect along a line).
NullPointerException
- If p1
, p2
, p3
or point
is null
.public float intersects(Bounds bounds)
bounds
- The bounding object to test intersection with.
Plane.INTERSECTS_BACK
if the specified bounding object is in the negative half-space of
this plane, Plane.INTERSECTS_FRONT
if it is in the positive half-space of this plane,
and Plane.INTERSECTS_INTERSECTING
if it intersects this plane.
NullPointerException
- If bounds
is null
.public float intersects(Frustum frustum)
frustum
- The frustum to test intersection with.
Plane.INTERSECTS_BACK
if the specified frustum is in the negative half-space of
this plane, Plane.INTERSECTS_FRONT
if it is in the positive half-space of this plane,
and Plane.INTERSECTS_INTERSECTING
if it intersects this plane.
NullPointerException
- If frustum
is null
.public float intersects(Plane plane)
plane
- The plane to test intersection with.
Plane.INTERSECTS_BACK
if the specified plane is in the negative half-space of
this plane, Plane.INTERSECTS_FRONT
if it is in the positive half-space of this plane,
and Plane.INTERSECTS_INTERSECTING
if it intersects this plane.
NullPointerException
- If plane
is null
.public float intersects(Ray ray)
ray
- The ray to test intersection with.
Plane.INTERSECTS_BACK
if the specified ray is in the negative half-space of
this plane, Plane.INTERSECTS_FRONT
if it is in the positive half-space of this plane,
and Plane.INTERSECTS_INTERSECTING
if it intersects this plane.
NullPointerException
- If ray
is null
.public void set(Vector3f normal, float distance)
normal
- The normal vector of this plane.distance
- The distance to this plane along its (unit) normal to the origin.
Note that if the normal vector is not a unit vector then the distance will be normalized.
IllegalArgumentException
- If normal
is the zero vector.
NullPointerException
- If normal
is null
.public void set(Plane plane)
plane
- The plane to set to.
NullPointerException
- If plane
is null
.public void setDistance(float distance)
distance
- The new distance.public void setNormal(Vector3f normal)
normal
- The new normal vector.
IllegalArgumentException
- If normal
is the zero vector.
NullPointerException
- If normal
is null
.public void setNormal(float nx, float ny, float nz)
nx
- The x coordinate of the new normal vector.ny
- The y coordinate of the new normal vector.nz
- The z coordinate of the new normal vector.
IllegalArgumentException
- If nx
, ny
, and nz
are all equal to zero.public void transform(Matrix4f matrix)
matrix
- The transformation matrix to transform by.
NullPointerException
- If matrix
is null
.public boolean equals(Object obj)
equals
in class Object
obj
- The object to compare.
true
if this plane is equal to obj
;
false
otherwise.
NullPointerException
- If obj
is null
.Boolean.hashCode()
,
Hashtable
public boolean equals(Plane plane)
plane
- The plane to compare.
true
if this plane is equal to plane
;
false
otherwise.
NullPointerException
- If plane
is null
.public int hashCode()
hashCode
in class Object
Object.equals(java.lang.Object)
,
Hashtable
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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