|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nasa.worldwind.geom.Sphere
public final class Sphere
Represents a sphere in three dimensional space.
Instances ofSphere are immutable.
| Field Summary | |
|---|---|
static Sphere |
UNIT_SPHERE
|
| Constructor Summary | |
|---|---|
Sphere(Vec4 center,
double radius)
Creates a new Sphere from a given center and radius. |
|
| Method Summary | |
|---|---|
static Vec4[] |
composeExtrema(Vec4[] points)
Calculate the extrema of a given array of Vec4s. |
static Sphere |
createBoundingSphere(Vec4[] points)
Creates a sphere that completely contains a set of points. |
boolean |
equals(Object o)
|
Vec4 |
getCenter()
Obtains the center of this Sphere. |
double |
getDiameter()
Obtains the diameter of this Sphere. |
double |
getRadius()
Obtains the radius of this Sphere. |
int |
hashCode()
|
Intersection[] |
intersect(Line line)
Obtains the intersections of this sphere with a line. |
boolean |
intersects(Frustum frustum)
tests for intersetion with a Frustum. |
boolean |
intersects(Line line)
Tests for intersection with a Line. |
boolean |
intersects(Plane plane)
Tests for intersection with a Plane. |
void |
render(DrawContext dc)
Causes this Sphere to render itself using the DrawContext provided. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Sphere UNIT_SPHERE
| Constructor Detail |
|---|
public Sphere(Vec4 center,
double radius)
Sphere from a given center and radius. radius must be positive (that is,
greater than zero), and center may not be null.
center - the center of the new sphereradius - the radius of the new sphere
IllegalArgumentException - if center is null or if radius is non-positive| Method Detail |
|---|
public static Vec4[] composeExtrema(Vec4[] points)
Vec4s. The resulting array is always of length 2, with the
first element containing the minimum extremum, and the second containing the maximum. The minimum extremum is
composed by taking the smallest x, y and z values from all the Vec4s in the array. These values are
not necessarily taken from the same Vec4. The maximum extrema is composed in the same fashion.
points - any array of Vec4s
IllegalArgumentException - if points is nullpublic static Sphere createBoundingSphere(Vec4[] points)
points - the Vec4s to be enclosed by the new Sphere
Sphere encompassing the given array of Vec4s
IllegalArgumentException - if points is null or emptypublic boolean equals(Object o)
equals in class Objectpublic final Vec4 getCenter()
Sphere.
getCenter in interface ExtentVec4 situated at the center of this Spherepublic final double getDiameter()
Sphere. The diameter is twice the radius.
getDiameter in interface ExtentSpherepublic final double getRadius()
Sphere. The radus is the distance from the center to the surface. If an
object's distance to this sphere's center is less than or equal to the radius, then that object is at least
partially within this Sphere.
getRadius in interface Extentpublic int hashCode()
hashCode in class Objectpublic final Intersection[] intersect(Line line)
line is considered to have infinite length in both directions.
intersect in interface Extentline - the Line with which to intersect this Sphere
Sphere and line
IllegalArgumentException - if line is nullpublic boolean intersects(Frustum frustum)
Frustum. This operation is commutative, so
someSphere.intersects(frustum) and frustum.intersects(someSphere) are equivalent.
intersects in interface Extentfrustum - the Frustum with which to test for intersection
frustum or this Sphere wholly or partially contain the other,
false otherwise.
IllegalArgumentException - if frustum is nullpublic boolean intersects(Line line)
Line.
intersects in interface Extentline - the Line with which to test for intersection
line intersects or makes a tangent with the surface of this Sphere
IllegalArgumentException - if line is nullpublic boolean intersects(Plane plane)
Plane.
intersects in interface Extentplane - the Plane with which to test for intersection
plane intersects or makes a tangent with the surface of this Sphere
IllegalArgumentException - if plane is nullpublic void render(DrawContext dc)
Sphere to render itself using the DrawContext provided. dc may
not be null.
render in interface Renderabledc - the DrawContext to be used
IllegalArgumentException - if dc is nullDrawContextpublic String toString()
toString in class Object
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||