Package javax.media.j3d
Class BoundingSphere
java.lang.Object
javax.media.j3d.Bounds
javax.media.j3d.BoundingSphere
- All Implemented Interfaces:
Cloneable
This class defines a spherical bounding region which is defined by a
center point and a radius.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs and initializes a BoundingSphere with radius = 1 at 0 0 0.BoundingSphere
(Bounds boundsObject) Constructs and initializes a BoundingSphere from a bounding object.BoundingSphere
(Bounds[] boundsObjects) Constructs and initializes a BoundingSphere from an array of bounding objects.BoundingSphere
(javax.vecmath.Point3d center, double radius) Constructs and initializes a BoundingSphere from a center and radius. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates a copy of the bounding sphere.closestIntersection
(Bounds[] boundsObjects) Finds closest bounding object that intersects this bounding sphere.void
Combines this bounding sphere with a bounding object so that the resulting bounding sphere encloses the original bounding sphere and the given bounds object.void
Combines this bounding sphere with an array of bounding objects so that the resulting bounding sphere encloses the original bounding sphere and the given array of bounds object.void
combine
(javax.vecmath.Point3d point) Combines this bounding sphere with a point.void
combine
(javax.vecmath.Point3d[] points) Combines this bounding sphere with an array of points.boolean
Indicates whether the specifiedbounds
object is equal to this BoundingSphere object.void
getCenter
(javax.vecmath.Point3d center) Returns the position of this bounding sphere as a point.double
Returns the radius of this bounding sphere as a double.int
hashCode()
Returns a hash code value for this BoundingSphere object based on the data values in this object.boolean
Test for intersection with another bounds object.boolean
Test for intersection with another bounds object.boolean
intersect
(Bounds[] boundsObjects, BoundingSphere newBoundSphere) Test for intersection with an array of bounds objects.boolean
intersect
(Bounds boundsObject, BoundingSphere newBoundSphere) Test for intersection with another bounds object.boolean
intersect
(javax.vecmath.Point3d point) Test for intersection with a point.boolean
intersect
(javax.vecmath.Point3d origin, javax.vecmath.Vector3d direction) Test for intersection with a ray.boolean
isEmpty()
Tests whether the bounding sphere is empty.void
Sets the value of this BoundingSphere.void
setCenter
(javax.vecmath.Point3d center) Sets the position of this bounding sphere from a point.void
setRadius
(double r) Sets the radius of this bounding sphere from a double.toString()
Returns a string representation of this class.void
transform
(Bounds boundsObject, Transform3D matrix) Modifies the bounding sphere so that it bounds the volume generated by transforming the given bounding object.void
transform
(Transform3D trans) Transforms this bounding sphere by the given matrix.
-
Constructor Details
-
BoundingSphere
public BoundingSphere(javax.vecmath.Point3d center, double radius) Constructs and initializes a BoundingSphere from a center and radius.- Parameters:
center
- the center of the bounding sphereradius
- the radius of the bounding sphere
-
BoundingSphere
public BoundingSphere()Constructs and initializes a BoundingSphere with radius = 1 at 0 0 0. -
BoundingSphere
Constructs and initializes a BoundingSphere from a bounding object.- Parameters:
boundsObject
- a bounds object
-
BoundingSphere
Constructs and initializes a BoundingSphere from an array of bounding objects.- Parameters:
boundsObjects
- an array of bounds objects
-
-
Method Details
-
getRadius
public double getRadius()Returns the radius of this bounding sphere as a double.- Returns:
- the radius of the bounding sphere
-
setRadius
public void setRadius(double r) Sets the radius of this bounding sphere from a double.- Parameters:
r
- the new radius for the bounding sphere
-
getCenter
public void getCenter(javax.vecmath.Point3d center) Returns the position of this bounding sphere as a point.- Parameters:
center
- a Point to receive the center of the bounding sphere
-
setCenter
public void setCenter(javax.vecmath.Point3d center) Sets the position of this bounding sphere from a point.- Parameters:
center
- a Point defining the new center of the bounding sphere
-
set
Sets the value of this BoundingSphere. -
clone
Creates a copy of the bounding sphere. -
equals
Indicates whether the specifiedbounds
object is equal to this BoundingSphere object. They are equal if the specifiedbounds
object is an instance of BoundingSphere and all of the data members ofbounds
are equal to the corresponding data members in this BoundingSphere. -
hashCode
public int hashCode()Returns a hash code value for this BoundingSphere object based on the data values in this object. Two different BoundingSphere objects with identical data values (i.e., BoundingSphere.equals returns true) will return the same hash code value. Two BoundingSphere objects with different data members may return the same hash code value, although this is not likely. -
combine
Combines this bounding sphere with a bounding object so that the resulting bounding sphere encloses the original bounding sphere and the given bounds object. -
combine
Combines this bounding sphere with an array of bounding objects so that the resulting bounding sphere encloses the original bounding sphere and the given array of bounds object. -
combine
public void combine(javax.vecmath.Point3d point) Combines this bounding sphere with a point. -
combine
public void combine(javax.vecmath.Point3d[] points) Combines this bounding sphere with an array of points. -
transform
Modifies the bounding sphere so that it bounds the volume generated by transforming the given bounding object. -
transform
Transforms this bounding sphere by the given matrix. -
intersect
public boolean intersect(javax.vecmath.Point3d origin, javax.vecmath.Vector3d direction) Test for intersection with a ray. -
intersect
public boolean intersect(javax.vecmath.Point3d point) Test for intersection with a point. -
isEmpty
public boolean isEmpty()Tests whether the bounding sphere is empty. A bounding sphere is empty if it is null (either by construction or as the result of a null intersection) or if its volume is negative. A bounding sphere with a volume of zero is not empty. -
intersect
Test for intersection with another bounds object. -
intersect
Test for intersection with another bounds object. -
intersect
Test for intersection with another bounds object.- Parameters:
boundsObject
- another bounds objectnewBoundSphere
- the new bounding sphere which is the intersection of the boundsObject and this BoundingSphere- Returns:
- true or false indicating if an intersection occured
-
intersect
Test for intersection with an array of bounds objects.- Parameters:
boundsObjects
- an array of bounds objectsnewBoundSphere
- the new bounding sphere which is the intersection of the boundsObject and this BoundingSphere- Returns:
- true or false indicating if an intersection occured
-
closestIntersection
Finds closest bounding object that intersects this bounding sphere.- Specified by:
closestIntersection
in classBounds
- Parameters:
boundsObjects
- an array of bounds objects- Returns:
- closest bounding object
-
toString
Returns a string representation of this class.
-