org.jscience.mathematics.geometry
Class CoordinatesUtils

java.lang.Object
  extended by org.jscience.mathematics.geometry.CoordinatesUtils

public final class CoordinatesUtils
extends java.lang.Object

The coordinate transformation math library. This class is duplicate with the rest of this package. It is useful for a quick conversion without the full burden from AbstractPoint allocation. Provides common coordinate tranformations. This class cannot be subclassed or instantiated because all methods are static.


Method Summary
static double[] cartesianToCylindrical(double x, double y, double z)
          Converts 3D cartesian coordinates to cylindrical coordinates.
static double[] cartesianToPolar(double x, double y)
          Converts cartesian coordinates to polar coordinates.
static double[] cartesianToSpherical(double x, double y, double z)
          Converts 3D cartesian coordinates to spherical polar coordinates.
static double[] cylindricalToCartesian(double r, double phi, double h)
          Converts cylindrical coordinates to cartesian coordinates.
static double[] cylindricalToSpherical(double r, double phi, double h)
          Converts cylindrical coordinates to spherical polar coordinates.
static double[] polarToCartesian(double r, double theta)
          Converts polar coordinates to cartesian coordinates.
static double[] sphericalToCartesian(double r, double theta, double phi)
          Converts spherical polar coordinates to 3D cartesian coordinates.
static double[] sphericalToCylindrical(double r, double theta, double phi)
          Converts spherical coordinates to cylindrical coordinates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

cartesianToPolar

public static double[] cartesianToPolar(double x,
                                        double y)
Converts cartesian coordinates to polar coordinates.

Parameters:
x - DOCUMENT ME!
y - DOCUMENT ME!
Returns:
an array with [0] containing the radius and [1] containing the angle.

polarToCartesian

public static double[] polarToCartesian(double r,
                                        double theta)
Converts polar coordinates to cartesian coordinates.

Parameters:
r - DOCUMENT ME!
theta - DOCUMENT ME!
Returns:
an array with [0] containing the x-coordinate and [1] containing the y-coordinate.

cartesianToSpherical

public static double[] cartesianToSpherical(double x,
                                            double y,
                                            double z)
Converts 3D cartesian coordinates to spherical polar coordinates.

Parameters:
x - DOCUMENT ME!
y - DOCUMENT ME!
z - DOCUMENT ME!
Returns:
an array with [0] containing the radius, [1] containing the theta angle and [2] containing the phi angle.

sphericalToCartesian

public static double[] sphericalToCartesian(double r,
                                            double theta,
                                            double phi)
Converts spherical polar coordinates to 3D cartesian coordinates.

Parameters:
r - DOCUMENT ME!
theta - DOCUMENT ME!
phi - DOCUMENT ME!
Returns:
an array with [0] containing the x-coordinate, [1] containing the y-coordinate and [2] containing the z-coordinate.

cartesianToCylindrical

public static double[] cartesianToCylindrical(double x,
                                              double y,
                                              double z)
Converts 3D cartesian coordinates to cylindrical coordinates.

Parameters:
x - DOCUMENT ME!
y - DOCUMENT ME!
z - DOCUMENT ME!
Returns:
an array with [0] containing the radius, [1] containing the angle and [2] containing the height.

cylindricalToCartesian

public static double[] cylindricalToCartesian(double r,
                                              double phi,
                                              double h)
Converts cylindrical coordinates to cartesian coordinates.

Parameters:
r - DOCUMENT ME!
phi - DOCUMENT ME!
h - DOCUMENT ME!
Returns:
an array with [0] containing the x-coordinate, [1] containing the y-coordinate and [2] containing the z-coordinate.

cylindricalToSpherical

public static double[] cylindricalToSpherical(double r,
                                              double phi,
                                              double h)
Converts cylindrical coordinates to spherical polar coordinates.

Parameters:
r - DOCUMENT ME!
phi - DOCUMENT ME!
h - DOCUMENT ME!
Returns:
an array with [0] containing the radius, [1] containing the theta angle and [2] containing the phi angle.

sphericalToCylindrical

public static double[] sphericalToCylindrical(double r,
                                              double theta,
                                              double phi)
Converts spherical coordinates to cylindrical coordinates.

Parameters:
r - DOCUMENT ME!
theta - DOCUMENT ME!
phi - DOCUMENT ME!
Returns:
an array with [0] containing the radius, [1] containing the angle and [2] containing the height.