|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.math.BoundingBox
public class BoundingBox
Defines a 3-dimensional axis-aligned bounding box.
Constructor Summary | ||
---|---|---|
BoundingBox()
Constructs an empty bounding box at the origin. |
||
BoundingBox(float[] array,
int offset)
Constructs a new bounding box from the specified values. |
||
BoundingBox(BoundingBox box)
Constructs a new bounding box from the given bounding box. |
||
BoundingBox(Vector3f min,
Vector3f max)
Constructs a new bounding box from the specified values. |
||
BoundingBox(Vector3f[] points)
Constructs a new bounding box that contains all of the specified points. |
Method Summary | ||
---|---|---|
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one. |
|
boolean |
equals(BoundingBox box)
Returns true if all elements of the specified bounding box are equal to the elements of this bounding box. |
|
void |
getCorners(Vector3f[] corners,
int offset)
Gets the corners of the bounding box in the specified array. |
|
void |
getMax(Vector3f max)
Gets the maximum point of the bounding box in the given point. |
|
void |
getMin(Vector3f min)
Gets the minimum point of the bounding box in the given point. |
|
int |
hashCode()
Returns a hash code value for the object. |
|
boolean |
intersects(Bounds bounds)
Tests whether this bounding object intersects the specified bounding object. |
|
boolean |
intersects(Frustum frustum)
Tests whether this bounding object intersects the specified frustum. |
|
float |
intersects(Plane plane)
Tests whether this bounding object intersects the specified plane. |
|
float |
intersects(Ray ray)
Tests whether this bounding object intersects the specified ray. |
|
boolean |
isEmpty()
Determines if this bounding object is empty. |
|
void |
merge(Bounds bounds)
Sets this bounding object to the smallest bounding object that contains both this bounding object and the specified bounds. |
|
void |
set(float[] array,
int offset)
Sets this bounding box to the specified values. |
|
void |
set(Bounds bounds)
Sets this bounding object to the specified bounding object. |
|
void |
set(Vector3f min,
Vector3f max)
Sets this bounding box to the specified values. |
|
void |
set(Vector3f[] points)
Sets this bounding box to the smallest bounding box that contains all of the specified points. |
|
void |
setMax(float maxX,
float maxY,
float maxZ)
Sets the maximum point of the bounding box to the specified values. |
|
void |
setMax(Vector3f max)
Sets the maximum point of the bounding box. |
|
void |
setMin(float minX,
float minY,
float minZ)
Sets the minimum point of the bounding box to the specified values. |
|
void |
setMin(Vector3f min)
Sets the minimum point of the bounding box. |
|
String |
toString()
Returns a string representation of the object. |
|
void |
transform(Matrix4f matrix)
Transforms the bounding object by the given transformation matrix. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BoundingBox()
public BoundingBox(Vector3f min, Vector3f max)
min
- The minimum point of the bounding box.max
- The maximum point of the bounding box.
IllegalArgumentException
- If the minimum and maximum values are invalid
(i.e. a max value is less than a min value).
NullPointerException
- If min
or max
is null
.public BoundingBox(float[] array, int offset)
array
- An array containing a sequence of floating point
values of the form [minX, minY, minZ, maxX, maxY, maxZ]
.offset
- The offset into the array where the values are stored.
IllegalArgumentException
- If the minimum and maximum values are invalid
(i.e. a max value is less than a min value).
IllegalArgumentException
- If offset
is less than zero or
offset + 5
is greater than or equal to array.length
.
NullPointerException
- If array
is null
.public BoundingBox(Vector3f[] points)
points
- The points to enclose inside the new bounding box.
NullPointerException
- If points
or points[i]
(for any integer 0 <= i < points.length
) is null
.public BoundingBox(BoundingBox box)
box
- The bounding box to copy.
NullPointerException
- If box
is null
.Method Detail |
---|
public void getCorners(Vector3f[] corners, int offset)
The corners are returned as follows: 0 to 3 specify the near face starting at the upper left point when looking towards the origin from the positive z-axis in a counter-clockwise fashion; 4 to 7 specify the far face starting at the upper left point when looking towards the origin from the negative z-axis in a counter-clockwise fashion.
corners
- The array to store the corners in.offset
- The offset to start storing the corners at.
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
.public void getMax(Vector3f max)
max
- The point to store the maximum point in.
NullPointerException
- If max
is null
.public void getMin(Vector3f min)
min
- The point to store the minimum point in.
NullPointerException
- If min
is null
.public boolean intersects(Bounds bounds)
Bounds
intersects
in interface Bounds
bounds
- The bounding object to test intersection with.
true
if the specified bounding object intersects this bounding object;
false
otherwise.Bounds.intersects(Bounds)
public boolean intersects(Frustum frustum)
Bounds
intersects
in interface Bounds
frustum
- The frustum to test intersection with.
true
if this bounding object intersects the specified frustum;
false
otherwise.Bounds.intersects(Frustum)
public float intersects(Plane plane)
Bounds
intersects
in interface Bounds
plane
- The plane to test intersection with.
INTERSECTS_BACK
if this bounding object 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.Bounds.intersects(Plane)
public float intersects(Ray ray)
Bounds
intersects
in interface Bounds
ray
- The ray to test intersection with.
INTERSECTS_NONE
if the ray does not intersect this bounding object.Bounds.intersects(Ray)
public boolean isEmpty()
Bounds
isEmpty
in interface Bounds
true
if this bounding object is empty;false
otherwise.Bounds.isEmpty()
public void merge(Bounds bounds)
Bounds
merge
in interface Bounds
bounds
- The bounding object to merge with.Bounds.merge(Bounds)
public void set(Vector3f min, Vector3f max)
min
- The minimum point of the bounding box.max
- The maximum point of the bounding box.
IllegalArgumentException
- If the minimum and maximum values are invalid
(i.e. a max value is less than a min value).
NullPointerException
- If min
or max
is null
.public void set(float[] array, int offset)
array
- An array containing a sequence of floating point
values of the form [minX, minY, minZ, maxX, maxY, maxZ]
.offset
- The offset into the array where the values are stored.
NullPointerException
- If array
is null
.
IllegalArgumentException
- If the minimum and maximum values are invalid
(i.e. a max value is less than a min value).
IllegalArgumentException
- If offset
is less than zero or
offset + 5
is greater than or equal to array.length
.public void set(Vector3f[] points)
points
- The points to enclose inside the bounding box.
NullPointerException
- If points
or points[i]
(for any integer 0 <= i < points.length
) is null
.public void set(Bounds bounds)
Bounds
set
in interface Bounds
bounds
- The bounding object to set to.Bounds.set(Bounds)
public void setMax(Vector3f max)
max
- The new maximum point.
IllegalArgumentException
- If (at least) one of the new maximum values
is less than its corresponding current minimum value.
NullPointerException
- If max
is null
.public void setMax(float maxX, float maxY, float maxZ)
maxX
- The new x coordinate of the maximum point.maxY
- The new y coordinate of the maximum point.maxZ
- The new z coordinate of the maximum point.
IllegalArgumentException
- If (at least) one of the new maximum values
is less than its corresponding current minimum value.public void setMin(Vector3f min)
min
- The new minimum point.
IllegalArgumentException
- If (at least) one of the new minimum values
is greater than its corresponding current maximum value.
NullPointerException
- If min
is null
.public void setMin(float minX, float minY, float minZ)
minX
- The new x coordinate of the minimum point.minY
- The new y coordinate of the minimum point.minZ
- The new z coordinate of the minimum point.
IllegalArgumentException
- If (at least) one of the new minimum values
is greater than its corresponding current maximum value.public void transform(Matrix4f matrix)
Bounds
transform
in interface Bounds
matrix
- The transformation matrix to transform by.Bounds.transform(Matrix4f)
public boolean equals(BoundingBox box)
box
- The bounding box to compare.
true
if this bounding box is equal to boundingBox
;
false
otherwise.
NullPointerException
- If boundingBox
is null
.public boolean equals(Object obj)
Object
The equals
method implements an equivalence relation:
x
,
x.equals(x)
should return true
.
x
and
y
, x.equals(y)
should return
true
if and only if y.equals(x)
returns
true
.
x
,
y
, and z
, if x.equals(y)
returns true
and y.equals(z)
returns
true
, then x.equals(z)
should return
true
.
x
and y
, multiple invocations of x.equals(y)
consistently return true
or consistently return
false
, provided no information used in
equals
comparisons on the object is modified.
x
,
x.equals(null)
should return false
.
The equals method for class Object
implements
the most discriminating possible equivalence relation on objects;
that is, for any reference values x
and y
,
this method returns true
if and only if x
and
y
refer to the same object (x==y
has the
value true
).
equals
in interface Bounds
equals
in class Object
obj
- the reference object with which to compare.
true
if this object is the same as the obj
argument; false
otherwise.Bounds.equals(Object)
public int hashCode()
Object
java.util.Hashtable
.
The general contract of hashCode
is:
hashCode
method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hashtables.
As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)
hashCode
in interface Bounds
hashCode
in class Object
Bounds.hashCode()
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
toString
in interface Bounds
toString
in class Object
Bounds.toString()
|
|||||||||
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