All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cynosurex.math.Vector

java.lang.Object
   |
   +----cynosurex.math.Vector

public class Vector
extends Object

Variable Index

 o vector
Internal storage of the vector.

Constructor Index

 o Vector(double, double)
Constructor to create a 2-dimensional vector.
 o Vector(double, double, double)
Constructor to create a 3-dimensional vector.
 o Vector(double[])
Constructor to create a n-dimensional vector from an array.

Method Index

 o addition(Vector, Vector)
Static method to add two vector together.
 o crossProduct(Vector, Vector)
Static method to calculate the cross product of two vectors of length 3.
 o dotProduct(Vector, Vector)
Static method to calculate the dot product of two vectors.
 o getDimension()
This method returns the dimension of the vector.
 o getInverse()
This method creates a new inverse vector based on the current vector.
 o getMagnitude()
This method returns the magnitude (length) of the vector.
 o getUnitVector()
This method creates a new unit vector based on the current vector.
 o getValueAt(int)
This method returns the value within the vector.
 o inverse()
This method inverses the current vector.
 o normalize()
This method normalizes the vector into an unit vector.
 o scalarMultiplication(double, Vector)
Static method to apply scalar multiplication to a vector.
 o toString()
This method overrides the super class method.

Variables

 o vector
 protected double vector[]
Internal storage of the vector.

Constructors

 o Vector
 public Vector(double vector[])
Constructor to create a n-dimensional vector from an array.

Parameters:
vector - the array of the vector
 o Vector
 public Vector(double x,
               double y)
Constructor to create a 2-dimensional vector.

Parameters:
x - value for x
y - value for y
 o Vector
 public Vector(double x,
               double y,
               double z)
Constructor to create a 3-dimensional vector.

Parameters:
x - value for x
y - value for y
z - value for z

Methods

 o addition
 public static Vector addition(Vector u,
                               Vector v)
Static method to add two vector together.

Parameters:
u - vector 1
v - vector 2
 o crossProduct
 public static Vector crossProduct(Vector u,
                                   Vector v)
Static method to calculate the cross product of two vectors of length 3.

Parameters:
u - vector 1
v - vector 2
 o dotProduct
 public static double dotProduct(Vector u,
                                 Vector v)
Static method to calculate the dot product of two vectors.

Parameters:
u - vector 1
v - vector 2
 o scalarMultiplication
 public static Vector scalarMultiplication(double value,
                                           Vector v)
Static method to apply scalar multiplication to a vector.

Parameters:
value - the value to multiply
v - the vector
 o getValueAt
 public double getValueAt(int pos)
This method returns the value within the vector.

Parameters:
pos - the position of the value
 o getMagnitude
 public double getMagnitude()
This method returns the magnitude (length) of the vector.

 o getDimension
 public int getDimension()
This method returns the dimension of the vector.

 o getInverse
 public Vector getInverse()
This method creates a new inverse vector based on the current vector.

 o inverse
 public void inverse()
This method inverses the current vector.

 o getUnitVector
 public Vector getUnitVector()
This method creates a new unit vector based on the current vector.

 o normalize
 public void normalize()
This method normalizes the vector into an unit vector.

 o toString
 public String toString()
This method overrides the super class method.

Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index