Package javax.media.j3d
Class BoundingSphere
- java.lang.Object
-
- javax.media.j3d.Bounds
-
- javax.media.j3d.BoundingSphere
-
- All Implemented Interfaces:
java.lang.Cloneable
public class BoundingSphere extends Bounds
This class defines a spherical bounding region which is defined by a center point and a radius.
-
-
Constructor Summary
Constructors Constructor Description BoundingSphere()Constructs 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Creates a copy of the bounding sphere.BoundsclosestIntersection(Bounds[] boundsObjects)Finds closest bounding object that intersects this bounding sphere.voidcombine(Bounds boundsObject)Combines this bounding sphere with a bounding object so that the resulting bounding sphere encloses the original bounding sphere and the given bounds object.voidcombine(Bounds[] boundsObjects)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.voidcombine(javax.vecmath.Point3d point)Combines this bounding sphere with a point.voidcombine(javax.vecmath.Point3d[] points)Combines this bounding sphere with an array of points.booleanequals(java.lang.Object bounds)Indicates whether the specifiedboundsobject is equal to this BoundingSphere object.voidgetCenter(javax.vecmath.Point3d center)Returns the position of this bounding sphere as a point.doublegetRadius()Returns the radius of this bounding sphere as a double.inthashCode()Returns a hash code value for this BoundingSphere object based on the data values in this object.booleanintersect(Bounds boundsObject)Test for intersection with another bounds object.booleanintersect(Bounds[] boundsObjects)Test for intersection with another bounds object.booleanintersect(Bounds[] boundsObjects, BoundingSphere newBoundSphere)Test for intersection with an array of bounds objects.booleanintersect(Bounds boundsObject, BoundingSphere newBoundSphere)Test for intersection with another bounds object.booleanintersect(javax.vecmath.Point3d point)Test for intersection with a point.booleanintersect(javax.vecmath.Point3d origin, javax.vecmath.Vector3d direction)Test for intersection with a ray.booleanisEmpty()Tests whether the bounding sphere is empty.voidset(Bounds boundsObject)Sets the value of this BoundingSphere.voidsetCenter(javax.vecmath.Point3d center)Sets the position of this bounding sphere from a point.voidsetRadius(double r)Sets the radius of this bounding sphere from a double.java.lang.StringtoString()Returns a string representation of this class.voidtransform(Bounds boundsObject, Transform3D matrix)Modifies the bounding sphere so that it bounds the volume generated by transforming the given bounding object.voidtransform(Transform3D trans)Transforms this bounding sphere by the given matrix.
-
-
-
Constructor Detail
-
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
public BoundingSphere(Bounds boundsObject)
Constructs and initializes a BoundingSphere from a bounding object.- Parameters:
boundsObject- a bounds object
-
BoundingSphere
public BoundingSphere(Bounds[] boundsObjects)
Constructs and initializes a BoundingSphere from an array of bounding objects.- Parameters:
boundsObjects- an array of bounds objects
-
-
Method Detail
-
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
public void set(Bounds boundsObject)
Sets the value of this BoundingSphere.
-
clone
public java.lang.Object clone()
Creates a copy of the bounding sphere.
-
equals
public boolean equals(java.lang.Object bounds)
Indicates whether the specifiedboundsobject is equal to this BoundingSphere object. They are equal if the specifiedboundsobject is an instance of BoundingSphere and all of the data members ofboundsare 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
public void combine(Bounds boundsObject)
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
public void combine(Bounds[] boundsObjects)
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
public void transform(Bounds boundsObject, Transform3D matrix)
Modifies the bounding sphere so that it bounds the volume generated by transforming the given bounding object.
-
transform
public void transform(Transform3D trans)
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
public boolean intersect(Bounds boundsObject)
Test for intersection with another bounds object.
-
intersect
public boolean intersect(Bounds[] boundsObjects)
Test for intersection with another bounds object.
-
intersect
public boolean intersect(Bounds boundsObject, BoundingSphere newBoundSphere)
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
public boolean intersect(Bounds[] boundsObjects, BoundingSphere newBoundSphere)
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
public Bounds closestIntersection(Bounds[] boundsObjects)
Finds closest bounding object that intersects this bounding sphere.- Specified by:
closestIntersectionin classBounds- Parameters:
boundsObjects- an array of bounds objects- Returns:
- closest bounding object
-
toString
public java.lang.String toString()
Returns a string representation of this class.- Overrides:
toStringin classjava.lang.Object
-
-