NASA World Wind

gov.nasa.worldwind.globes
Class EllipsoidalGlobe

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.globes.EllipsoidalGlobe
All Implemented Interfaces:
AVList, Extent, Globe, WWObject, PropertyChangeListener, EventListener
Direct Known Subclasses:
Earth, FlatGlobe, Mars, Moon

public class EllipsoidalGlobe
extends WWObjectImpl
implements Globe


Nested Class Summary
protected  class EllipsoidalGlobe.StateKey
           
 
Field Summary
protected  double equatorialRadius
           
protected  double es
           
protected  double polarRadius
           
 
Fields inherited from class gov.nasa.worldwind.avlist.AVListImpl
changeSupport
 
Constructor Summary
EllipsoidalGlobe(double equatorialRadius, double polarRadius, double es, ElevationModel em)
           
EllipsoidalGlobe(double equatorialRadius, double polarRadius, double es, ElevationModel em, Vec4 center)
           
 
Method Summary
protected  Position cartesianToGeodetic(Vec4 cart)
           
 Cylinder computeBoundingCylinder(double verticalExaggeration, Sector sector)
          Returns a cylinder that minimally surrounds the sector at a specified vertical exaggeration.
 Cylinder computeBoundingCylinder(double verticalExaggeration, Sector sector, double minElevation, double maxElevation)
          Returns a cylinder that minimally surrounds the specified minimum and maximum elevations in the sector at a specified vertical exaggeration.
protected  Cylinder computeBoundsFromSectorLatitudeRange(Sector sector, double minHeight, double maxHeight)
          Compute the Cylinder that surrounds the equator, and has height defined by the sector's minumum and maximum latitudes (including maxHeight).
protected  Cylinder computeBoundsFromSectorQuadrilateral(Sector sector, double minHeight, double maxHeight)
          Returns a cylinder that minimally surrounds the specified height range in the sector.
protected  Cylinder computeBoundsFromSectorVertices(Sector sector, double minHeight, double maxHeight)
          Returns a cylinder that surrounds the specified height range in the zero-area sector.
 Vec4 computeNorthPointingTangentAtLocation(Angle latitude, Angle longitude)
           
 Vec4 computePointFromPosition(Angle latitude, Angle longitude, double metersElevation)
           
 Vec4 computePointFromPosition(Position position)
           
 Position computePositionFromPoint(Vec4 point)
           
 Vec4 computeSurfaceNormalAtLocation(Angle latitude, Angle longitude)
          Returns the normal to the Globe at the specified position.
 Vec4 computeSurfaceNormalAtPoint(Vec4 point)
          Returns the normal to the Globe at the specified cartiesian point.
 Matrix computeTransformToPosition(Angle latitude, Angle longitude, double metersElevation)
          Returns the cartesian transform Matrix that maps coordinates to the local coordinate system at (latitude, longitude, metersElevation).
 Matrix computeTransformToPosition(Position position)
          Returns the cartesian transform Matrix that maps coordinates to the local coordinate system at (latitude, longitude, metersElevation).
protected  Vec4 geodeticToCartesian(Angle latitude, Angle longitude, double metersElevation)
          Maps a position to a flat world Cartesian coordinates.
 Vec4 getCenter()
           
 double getDiameter()
           
 double getEccentricitySquared()
           
 double getElevation(Angle latitude, Angle longitude)
           
 ElevationModel getElevationModel()
           
 double getElevations(Sector sector, List<? extends LatLon> latlons, double targetResolution, double[] elevations)
           
 double getEquatorialRadius()
           
 Extent getExtent()
           
 Position getIntersectionPosition(Line line)
           
 double getMaxElevation()
           
 double getMaximumRadius()
           
 double[] getMinAndMaxElevations(Sector sector)
           
 double getMinElevation()
           
 double getPolarRadius()
           
 double getRadius()
           
 double getRadiusAt(Angle latitude, Angle longitude)
           
 double getRadiusAt(LatLon latLon)
           
 Object getStateKey(DrawContext dc)
           
 Tessellator getTessellator()
           
 Intersection[] intersect(Line line)
          Obtain the intersections of this extent with line.
 Intersection[] intersect(Line line, double altitude)
           
protected  Intersection[] intersect(Line line, double equRadius, double polRadius)
           
 Intersection[] intersect(Triangle t, double elevation)
          Determines if and where a Triangle intersects the globe ellipsoid at a given elevation.
 boolean intersects(Frustum frustum)
          Tests whether or not this Extent intersects frustum.
 boolean intersects(Line line)
          Calculate whether or not line intersects this Extent.
 boolean intersects(Plane plane)
          Calculate whether or not this Extent is intersected by plane.
 boolean isPointAboveElevation(Vec4 point, double elevation)
          Determines whether a point is above a given elevation
 void setElevationModel(ElevationModel elevationModel)
           
 void setTessellator(Tessellator tessellator)
           
 SectorGeometryList tessellate(DrawContext dc)
           
 
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
propertyChange
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 

Field Detail

equatorialRadius

protected final double equatorialRadius

es

protected final double es

polarRadius

protected final double polarRadius
Constructor Detail

EllipsoidalGlobe

public EllipsoidalGlobe(double equatorialRadius,
                        double polarRadius,
                        double es,
                        ElevationModel em)

EllipsoidalGlobe

public EllipsoidalGlobe(double equatorialRadius,
                        double polarRadius,
                        double es,
                        ElevationModel em,
                        Vec4 center)
Method Detail

cartesianToGeodetic

protected Position cartesianToGeodetic(Vec4 cart)

computeBoundingCylinder

public Cylinder computeBoundingCylinder(double verticalExaggeration,
                                        Sector sector)
Returns a cylinder that minimally surrounds the sector at a specified vertical exaggeration.

Specified by:
computeBoundingCylinder in interface Globe
Parameters:
verticalExaggeration - the vertical exaggeration to apply to the globe's elevations when computing the cylinder.
sector - the sector to return the bounding cylinder for.
Returns:
The minimal bounding cylinder in Cartesian coordinates.
Throws:
IllegalArgumentException - if sector is null

computeBoundingCylinder

public Cylinder computeBoundingCylinder(double verticalExaggeration,
                                        Sector sector,
                                        double minElevation,
                                        double maxElevation)
Returns a cylinder that minimally surrounds the specified minimum and maximum elevations in the sector at a specified vertical exaggeration.

Specified by:
computeBoundingCylinder in interface Globe
Parameters:
verticalExaggeration - the vertical exaggeration to apply to the minimum and maximum elevations when computing the cylinder.
sector - the sector to return the bounding cylinder for.
minElevation - the minimum elevation of the bounding cylinder.
maxElevation - the maximum elevation of the bounding cylinder.
Returns:
The minimal bounding cylinder in Cartesian coordinates.
Throws:
IllegalArgumentException - if sector is null

computeBoundsFromSectorLatitudeRange

protected Cylinder computeBoundsFromSectorLatitudeRange(Sector sector,
                                                        double minHeight,
                                                        double maxHeight)
Compute the Cylinder that surrounds the equator, and has height defined by the sector's minumum and maximum latitudes (including maxHeight).

Parameters:
sector - the sector to return the bounding cylinder for.
minHeight - the minimum height to include in the bounding cylinder.
maxHeight - the maximum height to include in the bounding cylinder.
Returns:
the minimal bounding cylinder in Cartesianl coordinates.
Throws:
IllegalArgumentException - if sector is null

computeBoundsFromSectorQuadrilateral

protected Cylinder computeBoundsFromSectorQuadrilateral(Sector sector,
                                                        double minHeight,
                                                        double maxHeight)
Returns a cylinder that minimally surrounds the specified height range in the sector.

Parameters:
sector - the sector to return the bounding cylinder for.
minHeight - the minimum height to include in the bounding cylinder.
maxHeight - the maximum height to include in the bounding cylinder.
Returns:
The minimal bounding cylinder in Cartesian coordinates.
Throws:
IllegalArgumentException - if sector is null

computeBoundsFromSectorVertices

protected Cylinder computeBoundsFromSectorVertices(Sector sector,
                                                   double minHeight,
                                                   double maxHeight)
Returns a cylinder that surrounds the specified height range in the zero-area sector. The returned cylinder won't be as tight a fit as computeBoundsFromSectorQuadrilateral.

Parameters:
sector - the sector to return the bounding cylinder for.
minHeight - the minimum height to include in the bounding cylinder.
maxHeight - the maximum height to include in the bounding cylinder.
Returns:
The minimal bounding cylinder in Cartesian coordinates.
Throws:
IllegalArgumentException - if sector is null

computeNorthPointingTangentAtLocation

public Vec4 computeNorthPointingTangentAtLocation(Angle latitude,
                                                  Angle longitude)
Specified by:
computeNorthPointingTangentAtLocation in interface Globe

computePointFromPosition

public Vec4 computePointFromPosition(Angle latitude,
                                     Angle longitude,
                                     double metersElevation)
Specified by:
computePointFromPosition in interface Globe

computePointFromPosition

public Vec4 computePointFromPosition(Position position)
Specified by:
computePointFromPosition in interface Globe

computePositionFromPoint

public Position computePositionFromPoint(Vec4 point)
Specified by:
computePositionFromPoint in interface Globe

computeSurfaceNormalAtLocation

public Vec4 computeSurfaceNormalAtLocation(Angle latitude,
                                           Angle longitude)
Returns the normal to the Globe at the specified position.

Specified by:
computeSurfaceNormalAtLocation in interface Globe
Parameters:
latitude - the latitude of the position.
longitude - the longitude of the position.
Returns:
the Globe normal at the specified position.

computeSurfaceNormalAtPoint

public Vec4 computeSurfaceNormalAtPoint(Vec4 point)
Returns the normal to the Globe at the specified cartiesian point.

Specified by:
computeSurfaceNormalAtPoint in interface Globe
Parameters:
point - the cartesian point.
Returns:
the Globe normal at the specified point.

computeTransformToPosition

public Matrix computeTransformToPosition(Angle latitude,
                                         Angle longitude,
                                         double metersElevation)
Returns the cartesian transform Matrix that maps coordinates to the local coordinate system at (latitude, longitude, metersElevation). They X axis will mapped to the vector tangent to the globe and pointing East. The Y axis will mapped to the vector tangent to the Globe and pointing to the North Pole. The Z axis will be mapped to the Globe normal at (latitude, longitude, metersElevation). The origin will be mapped to the cartesian position of (latitude, longitude, metersElevation).

Specified by:
computeTransformToPosition in interface Globe
Parameters:
latitude - the latitude of the position.
longitude - the longitude of the position.
metersElevation - the number of meters above or below mean sea level.
Returns:
the cartesian transform Matrix that maps coordinates to the local coordinates at the specified position.

computeTransformToPosition

public Matrix computeTransformToPosition(Position position)
Returns the cartesian transform Matrix that maps coordinates to the local coordinate system at (latitude, longitude, metersElevation). They X axis will mapped to the vector tangent to the globe and pointing East. The Y axis will mapped to the vector tangent to the Globe and pointing to the North Pole. The Z axis will be mapped to the Globe normal at (latitude, longitude, metersElevation). The origin will be mapped to the cartesian position of (latitude, longitude, metersElevation).

Specified by:
computeTransformToPosition in interface Globe
Parameters:
position - the latitude, longitude, and number of meters above or below mean sea level.
Returns:
the cartesian transform Matrix that maps coordinates to the local coordinates at the specified position.

geodeticToCartesian

protected Vec4 geodeticToCartesian(Angle latitude,
                                   Angle longitude,
                                   double metersElevation)
Maps a position to a flat world Cartesian coordinates. The Y axis points to the north pole. The Z axis points to the intersection of the prime meridian and the equator, in the equatorial plane. The X axis completes a right-handed coordinate system, and is 90 degrees east of the Z axis and also in the equatorial plane. Sea level is at z = zero.

Parameters:
latitude - the latitude of the position.
longitude - the longitude of the position.
metersElevation - the number of meters above or below mean sea level.
Returns:
The Cartesian point corresponding to the input position.

getCenter

public Vec4 getCenter()
Specified by:
getCenter in interface Extent

getDiameter

public double getDiameter()
Specified by:
getDiameter in interface Extent

getEccentricitySquared

public double getEccentricitySquared()
Specified by:
getEccentricitySquared in interface Globe

getElevation

public double getElevation(Angle latitude,
                           Angle longitude)
Specified by:
getElevation in interface Globe

getElevationModel

public ElevationModel getElevationModel()
Specified by:
getElevationModel in interface Globe

getElevations

public double getElevations(Sector sector,
                            List<? extends LatLon> latlons,
                            double targetResolution,
                            double[] elevations)
Specified by:
getElevations in interface Globe

getEquatorialRadius

public double getEquatorialRadius()
Specified by:
getEquatorialRadius in interface Globe

getExtent

public Extent getExtent()
Specified by:
getExtent in interface Globe

getIntersectionPosition

public Position getIntersectionPosition(Line line)
Specified by:
getIntersectionPosition in interface Globe

getMaxElevation

public double getMaxElevation()
Specified by:
getMaxElevation in interface Globe

getMaximumRadius

public double getMaximumRadius()
Specified by:
getMaximumRadius in interface Globe

getMinAndMaxElevations

public double[] getMinAndMaxElevations(Sector sector)
Specified by:
getMinAndMaxElevations in interface Globe

getMinElevation

public double getMinElevation()
Specified by:
getMinElevation in interface Globe

getPolarRadius

public double getPolarRadius()
Specified by:
getPolarRadius in interface Globe

getRadius

public double getRadius()
Specified by:
getRadius in interface Extent

getRadiusAt

public double getRadiusAt(Angle latitude,
                          Angle longitude)
Specified by:
getRadiusAt in interface Globe

getRadiusAt

public double getRadiusAt(LatLon latLon)
Specified by:
getRadiusAt in interface Globe

getStateKey

public Object getStateKey(DrawContext dc)
Specified by:
getStateKey in interface Globe

getTessellator

public Tessellator getTessellator()
Specified by:
getTessellator in interface Globe

intersect

public Intersection[] intersect(Line line)
Description copied from interface: Extent
Obtain the intersections of this extent with line. The returned array may be either null or of zero length if no intersections are discovered. It does not contain null elements. Tangential intersections are marked as such. line is considered to have infinite length in both directions.

Specified by:
intersect in interface Extent
Parameters:
line - the Line with which to intersect this Extent
Returns:
an array of intersections representing all the points where line enters or leave this Extent

intersect

public Intersection[] intersect(Line line,
                                double altitude)
Specified by:
intersect in interface Globe

intersect

protected Intersection[] intersect(Line line,
                                   double equRadius,
                                   double polRadius)

intersect

public Intersection[] intersect(Triangle t,
                                double elevation)
Determines if and where a Triangle intersects the globe ellipsoid at a given elevation.

Specified by:
intersect in interface Globe
Parameters:
t - the Trinagle.
elevation - the elevation to test for.
Returns:
an array of two Intersection or null if no intersection was found.

intersects

public boolean intersects(Frustum frustum)
Description copied from interface: Extent
Tests whether or not this Extent intersects frustum. Returns true if any part of these two objects intersect, including the case where either object wholly contains the other, false otherwise.

Specified by:
intersects in interface Extent
Parameters:
frustum - the Frustum with which to test for intersection
Returns:
true if there is an intersection, false otherwise

intersects

public boolean intersects(Line line)
Description copied from interface: Extent
Calculate whether or not line intersects this Extent. This method may be faster than checking the size of the arary returned by intersect(Line). Implementing methods must ensure that this method returns true if and only if intersect(Line) returns a non-null array containing at least one element.

Specified by:
intersects in interface Extent
Parameters:
line - the Line with which to test for intersection
Returns:
true if an intersection is found, false otherwise

intersects

public boolean intersects(Plane plane)
Description copied from interface: Extent
Calculate whether or not this Extent is intersected by plane.

Specified by:
intersects in interface Extent
Parameters:
plane - the Plane with which to test for intersection
Returns:
true if plane is found to intersect this Extent

isPointAboveElevation

public boolean isPointAboveElevation(Vec4 point,
                                     double elevation)
Determines whether a point is above a given elevation

Specified by:
isPointAboveElevation in interface Globe
Parameters:
point - the Vec4 point to test.
elevation - the elevation to test for.
Returns:
true if the given point is above the given elevation.

setElevationModel

public void setElevationModel(ElevationModel elevationModel)
Specified by:
setElevationModel in interface Globe

setTessellator

public void setTessellator(Tessellator tessellator)
Specified by:
setTessellator in interface Globe

tessellate

public SectorGeometryList tessellate(DrawContext dc)
Specified by:
tessellate in interface Globe

NASA World Wind