Package gov.nasa.worldwind.geom
Class PolarPoint
- java.lang.Object
-
- gov.nasa.worldwind.geom.PolarPoint
-
public class PolarPoint extends java.lang.Object
Represents a point in space defined by a latitude, longitude and distance from the origin.Instances of
PolarPoint
are immutable.
-
-
Field Summary
Fields Modifier and Type Field Description static PolarPoint
ZERO
-
Constructor Summary
Constructors Constructor Description PolarPoint(Angle latitude, Angle longitude, double radius)
Obtains aPolarPoint
from twoangles
and a radius.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
static PolarPoint
fromCartesian(double x, double y, double z)
Obtains aPolarPoint
from cartesian coordinates.static PolarPoint
fromCartesian(Vec4 cartesianPoint)
Obtains aPolarPoint
from a cartesian point.static PolarPoint
fromDegrees(double latitude, double longitude, double radius)
Obtains aPolarPoint
from degrees and a radius.static PolarPoint
fromRadians(double latitude, double longitude, double radius)
Obtains aPolarPoint
from radians and a radius.Angle
getLatitude()
Obtains the latitude of this polar pointAngle
getLongitude()
Obtains the longitude of this polar pointdouble
getRadius()
Obtains the radius of this polar pointint
hashCode()
Vec4
toCartesian()
Obtains a cartesian point equivalent to thisPolarPoint
, except in cartesian space.static Vec4
toCartesian(Angle latitude, Angle longitude, double radius)
Obtains a cartesian point from a given latitude, longitude and distance from center.java.lang.String
toString()
-
-
-
Field Detail
-
ZERO
public static final PolarPoint ZERO
-
-
Constructor Detail
-
PolarPoint
public PolarPoint(Angle latitude, Angle longitude, double radius)
Obtains aPolarPoint
from twoangles
and a radius.- Parameters:
latitude
- the latitudelongitude
- the longituderadius
- the distance from the center- Throws:
java.lang.IllegalArgumentException
- iflatitude
orlongitude
is null
-
-
Method Detail
-
fromRadians
public static PolarPoint fromRadians(double latitude, double longitude, double radius)
Obtains aPolarPoint
from radians and a radius.- Parameters:
latitude
- the latitude in radianslongitude
- the longitude in radiansradius
- the distance form the center- Returns:
- a new
PolarPoint
-
fromDegrees
public static PolarPoint fromDegrees(double latitude, double longitude, double radius)
Obtains aPolarPoint
from degrees and a radius.- Parameters:
latitude
- the latitude in degreeslongitude
- the longitude in degreesradius
- the distance form the center- Returns:
- a new
PolarPoint
-
fromCartesian
public static PolarPoint fromCartesian(Vec4 cartesianPoint)
Obtains aPolarPoint
from a cartesian point.- Parameters:
cartesianPoint
- the point to convert- Returns:
- the cartesian point expressed as a polar point
- Throws:
java.lang.IllegalArgumentException
- ifcartesianPoint
is null
-
fromCartesian
public static PolarPoint fromCartesian(double x, double y, double z)
Obtains aPolarPoint
from cartesian coordinates.- Parameters:
x
- the x coordinate of the cartesian pointy
- the y coordinate of the cartesian pointz
- the z coordinate of the cartesian point- Returns:
- a polar point located at (x,y,z) in cartesian space
-
getLatitude
public final Angle getLatitude()
Obtains the latitude of this polar point- Returns:
- this polar point's latitude
-
getLongitude
public final Angle getLongitude()
Obtains the longitude of this polar point- Returns:
- this polar point's longitude
-
getRadius
public final double getRadius()
Obtains the radius of this polar point- Returns:
- the distance from this polar point to its origin
-
toCartesian
public final Vec4 toCartesian()
Obtains a cartesian point equivalent to thisPolarPoint
, except in cartesian space.- Returns:
- this polar point in cartesian coordinates
-
toCartesian
public static Vec4 toCartesian(Angle latitude, Angle longitude, double radius)
Obtains a cartesian point from a given latitude, longitude and distance from center. This method is equivalent to, but may perform faster thanVec4 p = new PolarPoint(latitude, longitude, radius).toCartesian()
- Parameters:
latitude
- the latitudelongitude
- the longituderadius
- the distance from the origin- Returns:
- a cartesian point from two angles and a radius
- Throws:
java.lang.IllegalArgumentException
- iflatitude
orlongitude
is null
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-