math.linearAlgebra
Class VectorMath

java.lang.Object
  extended by math.linearAlgebra.VectorMath

public final class VectorMath
extends java.lang.Object

Title: VectorMath Description: A utility class for vector math. Define static methods for dot products, cross products, etc. Copyright: Copyright (c) 2003 Gould, Christian, and Tobochnik

Version:
1.0
Author:
Wolfgang Christian

Constructor Summary
VectorMath()
           
 
Method Summary
static double[] cross2D(double[] a, double b)
          Calculate the cross product of a vector within a plane and a vector perpendicular to a plane.
static double cross2D(double[] a, double[] b)
          Calculate the cross product of two vectors that lie within a plane.
static double dot(double[] a)
          Calculate the dot product of a vector with itself.
static double dot(double[] a, double[] b)
          Calculate the dot product of two vectors.
static double magnitude(double[] a)
          Calculate the magnitude a vector.
static void plus(double[] a, double[] b)
          Add two vectors.
static void plus(double[] a, double[] b, double c)
          Add a vector times a scalar to a vector.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VectorMath

public VectorMath()
Method Detail

plus

public static void plus(double[] a,
                        double[] b,
                        double c)
Add a vector times a scalar to a vector. The first vector contains the sum.

Parameters:
a - the first vector
b - the second vector
c - the scalar multiplier

plus

public static void plus(double[] a,
                        double[] b)
Add two vectors. The first vector contains the sum.

Parameters:
a - the first vector
b - the second vector

dot

public static double dot(double[] a,
                         double[] b)
Calculate the dot product of two vectors.

Parameters:
a - the first vector
b - the second vector
Returns:
the dot product

dot

public static double dot(double[] a)
Calculate the dot product of a vector with itself.

Parameters:
a - the vector
Returns:
the dot product

magnitude

public static double magnitude(double[] a)
Calculate the magnitude a vector.

Parameters:
a - the vector
Returns:
the magnitude

cross2D

public static double cross2D(double[] a,
                             double[] b)
Calculate the cross product of two vectors that lie within a plane. The result is the component perpendicular to the plane.

Parameters:
a - the first vector
b - the second vector
Returns:
the cross product.

cross2D

public static double[] cross2D(double[] a,
                               double b)
Calculate the cross product of a vector within a plane and a vector perpendicular to a plane. The operation transforms the vector in the plane into the new vector.

Parameters:
a - the vector in the plane
b - the vector perpendicular to the plane