|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcynosurex.math.Vector
public class Vector
Field Summary | |
---|---|
protected double[] |
vector
Internal storage of the vector. |
Fields inherited from interface cynosurex.internal.CommonInterface |
---|
copyright, copyrightYears, notice, program, version |
Fields inherited from interface cynosurex.internal.AuthorCommon |
---|
author, copyrightSymbol, noticeMsg, rights |
Fields inherited from interface cynosurex.internal.CompanyCommon |
---|
company, email, website |
Constructor Summary | |
---|---|
Vector(double[] vector)
Constructor to create a n-dimensional vector from an array. |
|
Vector(double x,
double y)
Constructor to create a 2-dimensional vector. |
|
Vector(double x,
double y,
double z)
Constructor to create a 3-dimensional vector. |
Method Summary | |
---|---|
static Vector |
addition(Vector u,
Vector v)
Static method to add two vector together. |
static Vector |
crossProduct(Vector u,
Vector v)
Static method to calculate the cross product of two vectors of length 3. |
static double |
dotProduct(Vector u,
Vector v)
Static method to calculate the dot product of two vectors. |
int |
getDimension()
This method returns the dimension of the vector. |
Vector |
getInverse()
This method creates a new inverse vector based on the current vector. |
double |
getMagnitude()
This method returns the magnitude (length) of the vector. |
Vector |
getUnitVector()
This method creates a new unit vector based on the current vector. |
double |
getValueAt(int pos)
This method returns the value within the vector. |
void |
inverse()
This method inverses the current vector. |
void |
normalize()
This method normalizes the vector into an unit vector. |
static Vector |
scalarMultiplication(double value,
Vector v)
Static method to apply scalar multiplication to a vector. |
java.lang.String |
toString()
This method overrides the super class method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected double[] vector
Constructor Detail |
---|
public Vector(double[] vector)
vector
- the array of the vectorpublic Vector(double x, double y)
x
- value for xy
- value for ypublic Vector(double x, double y, double z)
x
- value for xy
- value for yz
- value for zMethod Detail |
---|
public static Vector addition(Vector u, Vector v)
u
- vector 1v
- vector 2public static Vector crossProduct(Vector u, Vector v)
u
- vector 1v
- vector 2public static double dotProduct(Vector u, Vector v)
u
- vector 1v
- vector 2public static Vector scalarMultiplication(double value, Vector v)
value
- the value to multiplyv
- the vectorpublic double getValueAt(int pos)
pos
- the position of the valuepublic double getMagnitude()
public int getDimension()
public Vector getInverse()
public void inverse()
public Vector getUnitVector()
public void normalize()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |