All Packages Class Hierarchy This Package Previous Next Index
Class cynosurex.math.Vector
java.lang.Object
|
+----cynosurex.math.Vector
- public class Vector
- extends Object
-
vector
- Internal storage of the vector.
-
Vector(double, double)
- Constructor to create a 2-dimensional vector.
-
Vector(double, double, double)
- Constructor to create a 3-dimensional vector.
-
Vector(double[])
- Constructor to create a n-dimensional vector from an array.
-
addition(Vector, Vector)
- Static method to add two vector together.
-
crossProduct(Vector, Vector)
- Static method to calculate the cross product of two vectors
of length 3.
-
dotProduct(Vector, Vector)
- Static method to calculate the dot product of two vectors.
-
getDimension()
- This method returns the dimension of the vector.
-
getInverse()
- This method creates a new inverse vector based on the current
vector.
-
getMagnitude()
- This method returns the magnitude (length) of the vector.
-
getUnitVector()
- This method creates a new unit vector based on the current vector.
-
getValueAt(int)
- This method returns the value within the vector.
-
inverse()
- This method inverses the current vector.
-
normalize()
- This method normalizes the vector into an unit vector.
-
scalarMultiplication(double, Vector)
- Static method to apply scalar multiplication to a vector.
-
toString()
- This method overrides the super class method.
vector
protected double vector[]
- Internal storage of the vector.
Vector
public Vector(double vector[])
- Constructor to create a n-dimensional vector from an array.
- Parameters:
- vector - the array of the vector
Vector
public Vector(double x,
double y)
- Constructor to create a 2-dimensional vector.
- Parameters:
- x - value for x
- y - value for y
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
addition
public static Vector addition(Vector u,
Vector v)
- Static method to add two vector together.
- Parameters:
- u - vector 1
- v - vector 2
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
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
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
getValueAt
public double getValueAt(int pos)
- This method returns the value within the vector.
- Parameters:
- pos - the position of the value
getMagnitude
public double getMagnitude()
- This method returns the magnitude (length) of the vector.
getDimension
public int getDimension()
- This method returns the dimension of the vector.
getInverse
public Vector getInverse()
- This method creates a new inverse vector based on the current
vector.
inverse
public void inverse()
- This method inverses the current vector.
getUnitVector
public Vector getUnitVector()
- This method creates a new unit vector based on the current vector.
normalize
public void normalize()
- This method normalizes the vector into an unit vector.
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