Package gov.nasa.worldwind.geom
Class PolarPoint
- java.lang.Object
-
- gov.nasa.worldwind.geom.PolarPoint
-
public class PolarPoint extends java.lang.ObjectRepresents a point in space defined by a latitude, longitude and distance from the origin.Instances of
PolarPointare immutable.
-
-
Field Summary
Fields Modifier and Type Field Description static PolarPointZERO
-
Constructor Summary
Constructors Constructor Description PolarPoint(Angle latitude, Angle longitude, double radius)Obtains aPolarPointfrom twoanglesand a radius.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)static PolarPointfromCartesian(double x, double y, double z)Obtains aPolarPointfrom cartesian coordinates.static PolarPointfromCartesian(Vec4 cartesianPoint)Obtains aPolarPointfrom a cartesian point.static PolarPointfromDegrees(double latitude, double longitude, double radius)Obtains aPolarPointfrom degrees and a radius.static PolarPointfromRadians(double latitude, double longitude, double radius)Obtains aPolarPointfrom radians and a radius.AnglegetLatitude()Obtains the latitude of this polar pointAnglegetLongitude()Obtains the longitude of this polar pointdoublegetRadius()Obtains the radius of this polar pointinthashCode()Vec4toCartesian()Obtains a cartesian point equivalent to thisPolarPoint, except in cartesian space.static Vec4toCartesian(Angle latitude, Angle longitude, double radius)Obtains a cartesian point from a given latitude, longitude and distance from center.java.lang.StringtoString()
-
-
-
Field Detail
-
ZERO
public static final PolarPoint ZERO
-
-
Constructor Detail
-
PolarPoint
public PolarPoint(Angle latitude, Angle longitude, double radius)
Obtains aPolarPointfrom twoanglesand a radius.- Parameters:
latitude- the latitudelongitude- the longituderadius- the distance from the center- Throws:
java.lang.IllegalArgumentException- iflatitudeorlongitudeis null
-
-
Method Detail
-
fromRadians
public static PolarPoint fromRadians(double latitude, double longitude, double radius)
Obtains aPolarPointfrom 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 aPolarPointfrom 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 aPolarPointfrom a cartesian point.- Parameters:
cartesianPoint- the point to convert- Returns:
- the cartesian point expressed as a polar point
- Throws:
java.lang.IllegalArgumentException- ifcartesianPointis null
-
fromCartesian
public static PolarPoint fromCartesian(double x, double y, double z)
Obtains aPolarPointfrom 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- iflatitudeorlongitudeis null
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-