|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.math.BoundingSphere
public class BoundingSphere
Defines a 3-dimensional bounding sphere.
Constructor Summary | ||
---|---|---|
BoundingSphere()
Constructs a new bounding sphere initialized to all zeros. |
||
BoundingSphere(float[] array,
int offset)
Constructs a new bounding sphere from the specified values. |
||
BoundingSphere(BoundingSphere sphere)
Constructs a bounding sphere from the given bounding sphere. |
||
BoundingSphere(Vector3f center,
float radius)
Constructs a new bounding sphere initialized to the specified values. |
||
BoundingSphere(Vector3f[] points)
Constructs a new bounding sphere 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(BoundingSphere sphere)
Returns true if all elements of the specified bounding sphere are equal to the elements of this bounding sphere. |
|
void |
getCenter(Vector3f center)
Gets the bounding sphere's center in the given point. |
|
float |
getRadius()
Gets the bounding sphere's radius. |
|
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 sphere to the specified values. |
|
void |
set(Bounds bounds)
Sets this bounding object to the specified bounding object. |
|
void |
set(Vector3f center,
float radius)
Sets this bounding sphere to the specified values. |
|
void |
set(Vector3f[] points)
Sets this bounding sphere to the smallest bounding sphere that contains all of the specified points. |
|
void |
setCenter(float cx,
float cy,
float cz)
Sets the bounding sphere's center to the specified values. |
|
void |
setCenter(Vector3f center)
Sets the bounding sphere's center. |
|
void |
setRadius(float radius)
Sets the bounding sphere's radius. |
|
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 BoundingSphere()
public BoundingSphere(Vector3f center, float radius)
center
- The center of the sphere.radius
- The radius of the sphere.
IllegalArgumentException
- If the radius is negative.
NullPointerException
- If center
is null
.public BoundingSphere(float[] array, int offset)
array
- An array containing a sequence of floating point
values of the form [cx, cy, cz, radius]
.offset
- The offset into the array where the values are stored.
NullPointerException
- If array
is null
.
IllegalArgumentException
- If the radius is negative.
IllegalArgumentException
- If offset
is less than zero or
offset + 3
is greater than or equal to array.length
.public BoundingSphere(Vector3f[] points)
points
- The points to enclose inside the new bounding sphere.
NullPointerException
- If points
or points[i]
(for any integer 0 <= i < points.length
) is null
.public BoundingSphere(BoundingSphere sphere)
sphere
- The bounding sphere to copy.
NullPointerException
- If sphere
is null
.Method Detail |
---|
public void getCenter(Vector3f center)
center
- The point to store the center in.
NullPointerException
- If center
is null
.public float getRadius()
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 center, float radius)
center
- The center of the sphere.radius
- The radius of the sphere.
IllegalArgumentException
- If the radius is negative.
NullPointerException
- If center
is null
.public void set(float[] array, int offset)
array
- An array containing a sequence of floating point
values of the form [cx, cy, cz, radius]
.offset
- The offset into the array where the values are stored.
NullPointerException
- If array
is null
.
IllegalArgumentException
- If the radius is negative.
IllegalArgumentException
- If offset
is less than zero or
offset + 3
is greater than or equal to array.length
.public void set(Vector3f[] points)
points
- The points to enclose inside the bounding sphere.
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 setCenter(Vector3f center)
center
- The new center point.
NullPointerException
- If center
is null
.public void setCenter(float cx, float cy, float cz)
cx
- The new x coordinate of the center.cy
- The new y coordinate of the center.cz
- The new z coordinate of the center.public void setRadius(float radius)
radius
- The new radius.
IllegalArgumentException
- If the given radius is negative.public void transform(Matrix4f matrix)
Bounds
transform
in interface Bounds
matrix
- The transformation matrix to transform by.Bounds.transform(Matrix4f)
public boolean equals(BoundingSphere sphere)
sphere
- The bounding sphere to compare.
true
if this bounding sphere is equal to boundingSphere
;
false
otherwise.
NullPointerException
- If sphere
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