Package gov.nasa.worldwind.globe
Class Globe
- java.lang.Object
-
- gov.nasa.worldwind.globe.Globe
-
public class Globe extends java.lang.Object
Planet or celestial object approximated by a reference ellipsoid and elevation models. Globe expresses its ellipsoidal parameters and elevation values in meters.
-
-
Constructor Summary
Constructors Constructor Description Globe(Ellipsoid ellipsoid, GeographicProjection projection)
Constructs a globe with a specified reference ellipsoid and projection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Position
cartesianToGeographic(double x, double y, double z, Position result)
Converts a Cartesian point to a geographic position.Matrix4
cartesianToLocalTransform(double x, double y, double z, Matrix4 result)
Vec3
geographicToCartesian(double latitude, double longitude, double altitude, Vec3 result)
Converts a geographic position to Cartesian coordinates.float[]
geographicToCartesianBorder(Sector sector, int numLat, int numLon, float height, Vec3 origin, float[] result)
float[]
geographicToCartesianGrid(Sector sector, int numLat, int numLon, float[] height, float verticalExaggeration, Vec3 origin, float[] result, int offset, int rowStride)
Vec3
geographicToCartesianNormal(double latitude, double longitude, Vec3 result)
Matrix4
geographicToCartesianTransform(double latitude, double longitude, double altitude, Matrix4 result)
double
getEccentricitySquared()
Indicates the eccentricity squared parameter of the globe's ellipsoid.double
getElevationAtLocation(double latitude, double longitude)
Determine terrain altitude in specified geographic point from elevation modelElevationModel
getElevationModel()
Ellipsoid
getEllipsoid()
Indicates the reference ellipsoid defining this globe's equatorial radius and polar radius.double
getEquatorialRadius()
Indicates the radius in meters of the globe's ellipsoid at the equator.double
getPolarRadius()
Indicates the radius in meters of the globe's ellipsoid at the poles.GeographicProjection
getProjection()
Indicates the geographic projection used by this globe.double
getRadiusAt(double latitude, double longitude)
Indicates the radius in meters of the globe's ellipsoid at a specified location.double
horizonDistance(double height)
Indicates the distance to the globe's horizon from a specified height above the globe's ellipsoid.boolean
intersect(Line line, Vec3 result)
Computes the first intersection of this globe with a specified line.void
setElevationModel(ElevationModel elevationModel)
void
setEllipsoid(Ellipsoid ellipsoid)
Sets the reference ellipsoid that defines this globe's equatorial radius and polar radius.void
setProjection(GeographicProjection projection)
Sets the geographic projection used by this globe.
-
-
-
Constructor Detail
-
Globe
public Globe(Ellipsoid ellipsoid, GeographicProjection projection)
Constructs a globe with a specified reference ellipsoid and projection.- Parameters:
ellipsoid
- the reference ellipsoid defining the globe's equatorial radius and polar radiusprojection
- the geographic projection used by the globe, specifies the globe's Cartesian coordinate system- Throws:
java.lang.IllegalArgumentException
- If the ellipsoid is null
-
-
Method Detail
-
getEllipsoid
public Ellipsoid getEllipsoid()
Indicates the reference ellipsoid defining this globe's equatorial radius and polar radius.- Returns:
- this globe's reference ellipsoid
-
setEllipsoid
public void setEllipsoid(Ellipsoid ellipsoid)
Sets the reference ellipsoid that defines this globe's equatorial radius and polar radius.- Parameters:
ellipsoid
- the new reference ellipsoid- Throws:
java.lang.IllegalArgumentException
- If the ellipsoid is null
-
getEquatorialRadius
public double getEquatorialRadius()
Indicates the radius in meters of the globe's ellipsoid at the equator.- Returns:
- the radius at the equator, in meters.
-
getPolarRadius
public double getPolarRadius()
Indicates the radius in meters of the globe's ellipsoid at the poles.- Returns:
- the radius at the poles, in meters.
-
getRadiusAt
public double getRadiusAt(double latitude, double longitude)
Indicates the radius in meters of the globe's ellipsoid at a specified location.- Parameters:
latitude
- the location's latitude in degreeslongitude
- the location's longitude in degrees- Returns:
- the radius in meters of the globe's ellipsoid at the specified location
-
getEccentricitySquared
public double getEccentricitySquared()
Indicates the eccentricity squared parameter of the globe's ellipsoid. This is equivalent to2*f - f*f
, wheref
is the ellipsoid's flattening parameter.- Returns:
- the eccentricity squared parameter of the globe's ellipsoid.
-
getElevationModel
public ElevationModel getElevationModel()
-
setElevationModel
public void setElevationModel(ElevationModel elevationModel)
-
getProjection
public GeographicProjection getProjection()
Indicates the geographic projection used by this globe. The projection specifies this globe's Cartesian coordinate system.- Returns:
- the globe's projection
-
setProjection
public void setProjection(GeographicProjection projection)
Sets the geographic projection used by this globe. The projection specifies this globe's Cartesian coordinate system.- Parameters:
projection
- the projection to use- Throws:
java.lang.IllegalArgumentException
- if the projection is null
-
geographicToCartesian
public Vec3 geographicToCartesian(double latitude, double longitude, double altitude, Vec3 result)
Converts a geographic position to Cartesian coordinates. This globe's projection specifies the Cartesian coordinate system.- Parameters:
latitude
- the position's latitude in degreeslongitude
- the position's longitude in degreesaltitude
- the position's altitude in metersresult
- a pre-allocatedVec3
in which to store the computed X, Y and Z Cartesian coordinates- Returns:
- the result argument, set to the computed Cartesian coordinates
- Throws:
java.lang.IllegalArgumentException
- if the result is null
-
geographicToCartesianNormal
public Vec3 geographicToCartesianNormal(double latitude, double longitude, Vec3 result)
-
geographicToCartesianTransform
public Matrix4 geographicToCartesianTransform(double latitude, double longitude, double altitude, Matrix4 result)
-
geographicToCartesianGrid
public float[] geographicToCartesianGrid(Sector sector, int numLat, int numLon, float[] height, float verticalExaggeration, Vec3 origin, float[] result, int offset, int rowStride)
-
geographicToCartesianBorder
public float[] geographicToCartesianBorder(Sector sector, int numLat, int numLon, float height, Vec3 origin, float[] result)
-
cartesianToGeographic
public Position cartesianToGeographic(double x, double y, double z, Position result)
Converts a Cartesian point to a geographic position. This globe's projection specifies the Cartesian coordinate system.- Parameters:
x
- the Cartesian point's X componenty
- the Cartesian point's Y componentz
- the Cartesian point's Z componentresult
- a pre-allocatedPosition
in which to store the computed geographic position- Returns:
- the result argument, set to the computed geographic position
- Throws:
java.lang.IllegalArgumentException
- if the result is null
-
cartesianToLocalTransform
public Matrix4 cartesianToLocalTransform(double x, double y, double z, Matrix4 result)
-
horizonDistance
public double horizonDistance(double height)
Indicates the distance to the globe's horizon from a specified height above the globe's ellipsoid. The result of this method is undefined if the height is negative.- Parameters:
height
- the viewer's height above the globe's ellipsoid in meters- Returns:
- the horizon distance in meters
-
intersect
public boolean intersect(Line line, Vec3 result)
Computes the first intersection of this globe with a specified line. The line is interpreted as a ray; intersection points behind the line's origin are ignored.- Parameters:
line
- the line to intersect with this globeresult
- a pre-allocatedVec3
in which to return the computed point- Returns:
- true if the ray intersects the globe, otherwise false
- Throws:
java.lang.IllegalArgumentException
- If either argument is null
-
getElevationAtLocation
public double getElevationAtLocation(double latitude, double longitude)
Determine terrain altitude in specified geographic point from elevation model- Parameters:
latitude
- location latitudelongitude
- location longitude- Returns:
- Elevation in meters in specified location
-
-