public final class Sphere extends Object implements Extent, Renderable
Sphere are immutable. | Modifier and Type | Field and Description | 
|---|---|
| protected Vec4 | center | 
| protected double | radius | 
| static Sphere | UNIT_SPHERE | 
| Constructor and Description | 
|---|
| Sphere(Vec4 center,
      double radius)Creates a new  Spherefrom a given center and radius. | 
| Modifier and Type | Method and Description | 
|---|---|
| static Sphere | createBoundingSphere(BufferWrapper buffer)Creates a sphere that completely contains a set of points. | 
| static Sphere | createBoundingSphere(Iterable<? extends Extent> extents)Creates a sphere that completely contains a set of Extents. | 
| 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 | getEffectiveRadius(Plane plane)Computes the effective radius of the extent relative to a specified plane. | 
| Vec4 | getPointOnSphere(LatLon location)Computes a point on the sphere corresponding to a specified location. | 
| double | getProjectedArea(View view)Computes the area in square pixels of this  Extentafter it is projected into the specifiedview'sviewport. | 
| 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)Indicates whether a specified  Frustumintersects this sphere. | 
| 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  Sphereto render itself using theDrawContextprovided. | 
| String | toString() | 
protected final Vec4 center
protected final double radius
public static final Sphere UNIT_SPHERE
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 sphereIllegalArgumentException - if center is null or if radius is non-positivepublic static Sphere createBoundingSphere(BufferWrapper buffer)
buffer - the Cartesian coordinates to be enclosed by the new Sphere.Sphere encompassing the given coordinates.IllegalArgumentException - if buffer is null or contains fewer than three values.public static Sphere createBoundingSphere(Iterable<? extends Extent> extents)
extents - the extends to be enclosed by the new Sphere.IllegalArgumentException - if the Iterable is null.public static Sphere createBoundingSphere(Vec4[] points)
points - the Vec4s to be enclosed by the new SphereSphere encompassing the given array of Vec4sIllegalArgumentException - if points is null or emptypublic final Vec4 getCenter()
Sphere.public final double getDiameter()
Sphere. The diameter is twice the radius.getDiameter in interface ExtentSpherepublic double getEffectiveRadius(Plane plane)
getEffectiveRadius in interface Extentplane - the plane.public Vec4 getPointOnSphere(LatLon location)
location - the location to compute the point for.IllegalArgumentException - if the location is null.public double getProjectedArea(View view)
Extent after it is projected into the specified
 view's viewport. The returned value is the screen area that this Extent covers in the
 infinite plane defined by the view's viewport. This area is not limited to the size of the
 view's viewport, and portions of this Extent are not clipped by the view's
 frustum.
 
 This returns Double.POSITIVE_INFINITY if the view's eye point is inside this
 Extent, or if any portion of this Extent is behind the eye point. In either case, this
 Extent has no finite projection on the view.getProjectedArea in interface Extentview - the View for which to compute a projected screen area.Extent in square pixels, or
         Double.POSITIVE_INFINITY if the view's eye point is inside this
         Extent or part of this Extent is behind the view's eye point.public 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.public 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 SphereSphere and lineIllegalArgumentException - if line is nullpublic final boolean intersects(Frustum frustum)
Frustum intersects this sphere.intersects in interface Extentfrustum - the frustum to test.IllegalArgumentException - if the frustum is null.public boolean intersects(Line line)
Line.intersects in interface Extentline - the Line with which to test for intersectionline intersects or makes a tangent with the surface of this SphereIllegalArgumentException - if line is nullpublic boolean intersects(Plane plane)
Plane.intersects in interface Extentplane - the Plane with which to test for intersectionplane intersects or makes a tangent with the surface of this SphereIllegalArgumentException - 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 usedIllegalArgumentException - if dc is nullDrawContext