Jeospace API

org.jeospace.coordinate
Class Spherical

java.lang.Object
  extended byorg.jeospace.coordinate.Polar
      extended byorg.jeospace.coordinate.Spherical

public class Spherical
extends Polar

A concrete subclass of Polar implementing a spherical coordinate system. Spherical coordinates are used in geo-centric (and other system-centric) applications such as describing orbital positions.

In extending Polar:
the distance component is defined to be the radius from the origin of the system.

For further reference see: http://mathworld.wolfram.com/SphericalCoordinates.html

Version:
$Revision: 1.1.1.1 $
Author:
Rex Melton
See Also:
Longitude, Latitude, Length, Cartesian, Ellipsoidal, Polar

Field Summary
 
Fields inherited from class org.jeospace.coordinate.Polar
distance, latitude, longitude
 
Constructor Summary
Spherical()
          Create a Spherical coordinate object with default parameters.
Spherical(Cartesian cartesian)
          Create a Spherical coordinate object that cooresponds to the given Cartesian coordinate.
Spherical(double longitudeDegrees, double latitudeDegrees, Length radius)
          Create a Spherical coordinate object with the given parameters.
Spherical(Longitude longitude, Latitude latitude, Length radius)
          Create a Spherical coordinate object from the given objects.
Spherical(Polar polar)
          Construct a Spherical coordinate object from the argument Polar coordinate.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare two Spherical coordinate objects for equality.
 Cartesian getCartesian()
          Get the Cartesian representation of the Spherical coordinate.
 void getCartesian(Cartesian cartesian)
          Get the Cartesian representation of the Spherical coordinate.
 Cartesian getCartesian(Length scale)
          Get the Cartesian representation of the Spherical coordinate.
 void getVector(Spherical target, Cartesian vector)
          Get the Cartesian representation of the vector from this Spherical coordinate object to a target Spherical coordinate object.
 Cartesian getVector(Spherical target, Length scale)
          Get the Cartesian representation of the vector from this Spherical coordinate object to a target Spherical coordinate object.
 int hashCode()
          Calculate the hashcode
 void set(Cartesian cartesian)
          Set the Spherical coordinate object's components.
 void set(Polar polar)
          Set the Spherical coordinate object's components.
 java.lang.String toString()
          Return a string representation of this spherical coordinate.
 
Methods inherited from class org.jeospace.coordinate.Polar
clear, getAngularSeparation, set, set, setToAntipode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Spherical

public Spherical()
Create a Spherical coordinate object with default parameters.
longitude = 0 degrees
latitude = 0 degrees
radius = 0 meters


Spherical

public Spherical(Polar polar)
Construct a Spherical coordinate object from the argument Polar coordinate.

Parameters:
polar - the Polar coordinate to represent as a Spherical coordinate.

Spherical

public Spherical(Cartesian cartesian)
Create a Spherical coordinate object that cooresponds to the given Cartesian coordinate.

Parameters:
cartesian - the Cartesian coordinate to convert to a Spherical representation.

Spherical

public Spherical(double longitudeDegrees,
                 double latitudeDegrees,
                 Length radius)
Create a Spherical coordinate object with the given parameters.

Parameters:
longitudeDegrees - the double value initializer for the Longitude component
latitudeDegrees - the double value initializer for the Latitude component
radius - the Length component initializer

Spherical

public Spherical(Longitude longitude,
                 Latitude latitude,
                 Length radius)
Create a Spherical coordinate object from the given objects.

Parameters:
longitude - the Longitude component initializer
latitude - the Latitude component initializer
radius - the Length component initializer
Method Detail

set

public void set(Polar polar)
Set the Spherical coordinate object's components.

Overrides:
set in class Polar
Parameters:
polar - the Polar coordinate to represent as an Spherical coordinate.

set

public void set(Cartesian cartesian)
Set the Spherical coordinate object's components.

Specified by:
set in class Polar
Parameters:
cartesian - the Cartesian coordinate to convert to a Spherical representation.

getVector

public Cartesian getVector(Spherical target,
                           Length scale)
Get the Cartesian representation of the vector from this Spherical coordinate object to a target Spherical coordinate object.

Parameters:
target - the target Spherical coordinate object.
scale - the Length object scale factor.
Returns:
the Cartesian coordinate representing the vector value.

getVector

public void getVector(Spherical target,
                      Cartesian vector)
Get the Cartesian representation of the vector from this Spherical coordinate object to a target Spherical coordinate object.

Parameters:
target - the target Spherical coordinate object.
vector - the Cartesian coordinate to set to the vector value.

getCartesian

public Cartesian getCartesian()
Get the Cartesian representation of the Spherical coordinate.

Specified by:
getCartesian in class Polar
Returns:
the cartesian representation of this spherical coordinate

getCartesian

public Cartesian getCartesian(Length scale)
Get the Cartesian representation of the Spherical coordinate.

Specified by:
getCartesian in class Polar
Parameters:
scale - the Length object scale factor.
Returns:
the cartesian representation of this spherical coordinate

getCartesian

public void getCartesian(Cartesian cartesian)
Get the Cartesian representation of the Spherical coordinate.

Specified by:
getCartesian in class Polar
Parameters:
cartesian - the Cartesian object to initialize.

hashCode

public int hashCode()
Calculate the hashcode

Returns:
the hashcode

equals

public boolean equals(java.lang.Object obj)
Compare two Spherical coordinate objects for equality. The result is true if and only if the argument object is not null, is a Spherical coordinate object and represents an identical position as this Spherical coordinate object.

Two Spherical coordinate objects are equal only if it's constituent Longitude, Latitude and Length objects are equal.

Parameters:
obj - the object to compare with
Returns:
true if the Spherical coordinate objects are the same; false otherwise.

toString

public java.lang.String toString()
Return a string representation of this spherical coordinate.

Overrides:
toString in class Polar
Returns:
a string representation of this spherical coordinate

Jeospace API

Copyright © 2006 - jeospace.org