mhuss utils 1.1.5ws

com.mhuss.AstroLib
Class MathOps

java.lang.Object
  extended by com.mhuss.AstroLib.MathOps

public class MathOps
extends java.lang.Object

MathOps contains some useful trig, vector and matrix operations.

Based on C code by Bill Gray (www.projectpluto.com)


Field Summary
static int VECTOR_SIZE
           
 
Constructor Summary
MathOps()
           
 
Method Summary
static double acose(double arg)
          Calculates the arc cosine, but limits the input to the range ( -1.0 < rad < +1.0 ).
static double asine(double arg)
          Calculates the arc sine, but limits the input to the range ( -1.0 < rad < +1.0 ).
static void cartesianToPolar(double[] cartVect, double[] polarCoord)
           
static void polarToCartesian(double[] vectC, double[] vectP)
          Convert polar coordinates with radius to Cartesian coordinates added by w.
static void polarToCartesian(double[] vect, double lon, double lat, double radius)
          Convert polar coordinates with radius to Cartesian coordinates added by w.
static void rotateVector(double[] v, double angle, int axis)
          Rotate a vector along the specified axis.
static void setIdentityMatrix(double[] matrix)
          Initializes a matrix to base (identity) values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VECTOR_SIZE

public static final int VECTOR_SIZE
See Also:
Constant Field Values
Constructor Detail

MathOps

public MathOps()
Method Detail

acose

public static double acose(double arg)
Calculates the arc cosine, but limits the input to the range ( -1.0 < rad < +1.0 ).
This avoids overflow errors. If the input is <= -1.0 radians, Math.PI is returned. If the input is >= 1.0 radians, 0 is returned.

Parameters:
arg - The angle in radians
Returns:
The arc cosine, limited to the range 0 to Pi.

asine

public static double asine(double arg)
Calculates the arc sine, but limits the input to the range ( -1.0 < rad < +1.0 ).
This avoids overflow errors. If the input is less than -1 (radian), -PI/2 is returned. If the input is greater than 1 (radian), +PI/2 is returned.

Parameters:
arg - The angle in radians
Returns:
The arc sine, limited to the range -Pi/2 0 to Pi/2.

setIdentityMatrix

public static void setIdentityMatrix(double[] matrix)
Initializes a matrix to base (identity) values. The matrix is set as follows: [1][0][0] [0][1][0] [0][0][1]

Parameters:
matrix - The matrix to initialize

rotateVector

public static void rotateVector(double[] v,
                                double angle,
                                int axis)
Rotate a vector along the specified axis.

Parameters:
v - The vector to rotate
angle - The angle to use
axis - The axis along which to rotate

polarToCartesian

public static void polarToCartesian(double[] vect,
                                    double lon,
                                    double lat,
                                    double radius)
Convert polar coordinates with radius to Cartesian coordinates added by w. Strickling

Parameters:
vect - Vector to hold the Cartesian coordinates
lon - Polar longitude
lat - Polar latitude

polarToCartesian

public static void polarToCartesian(double[] vectC,
                                    double[] vectP)
Convert polar coordinates with radius to Cartesian coordinates added by w. Strickling

Parameters:
vectC - Vector to hold the Cartesian coordinates
vectP - Vector to hold the Polar coordinates

cartesianToPolar

public static void cartesianToPolar(double[] cartVect,
                                    double[] polarCoord)

mhuss utils 1.1.5ws

bottom text