JSci.maths
Class CoordinateMath

java.lang.Object
  extended byJSci.maths.AbstractMath
      extended byJSci.maths.CoordinateMath

public final class CoordinateMath
extends AbstractMath

The coordinate transformation math library. 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.

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.

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.

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.

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.

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.

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.

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.

Returns:
an array with [0] containing the radius, [1] containing the angle and [2] containing the height.