org.jscience.chemistry.quantum.math.vector
Class Vector3D

java.lang.Object
  extended by org.jscience.chemistry.quantum.math.vector.Vector3D

public class Vector3D
extends java.lang.Object

A special class representing R^3 vector. This class is purposely not derived from VectorND class, use toVectorND() method get an instance compliant with VectorND.


Field Summary
static Vector3D NULL_VECTOR
          Null vector in 3 dimensional space
static Vector3D UX
          Unit vector along X in 3 dimensional space
static Vector3D UY
          Unit vector along Y in 3 dimensional space
static Vector3D UZ
          Unit vector along Z in 3 dimensional space
 
Constructor Summary
Vector3D()
          Creates a new instance of Vector3D
Vector3D(double i, double j, double k)
          Creates a new Vector3D object.
Vector3D(Point3D point)
          Creates a new Vector3D object.
 
Method Summary
 Vector3D add(Vector3D b)
          addition of two vectors
 double angleWith(Vector3D b)
          Find the angle made with the vector.
 java.lang.Object clone()
          clone this vector ;) Cloning is getting interesting!
 Vector3D cross(Vector3D b)
          The cross product of two vectors (a.b).
 double dot(Vector3D b)
          The dot product of two vectors (a.b)
 boolean equals(java.lang.Object obj)
          overloaded equals() method
 double getI()
          Getter for property i.
 double getJ()
          Getter for property j.
 double getK()
          Getter for property k.
 int hashCode()
          overriden hashCode() method
 double magnitude()
          The magnitude of this vector
 Vector3D mul(double k)
          multiplication of this vector with a scalar k
 Vector3D negate()
          negate this vector
 Vector3D normalize()
          get the normalized form of this vector
 void setI(double i)
          Setter for property i.
 void setJ(double j)
          Setter for property j.
 void setK(double k)
          Setter for property k.
 Vector3D sub(Vector3D b)
          substraction of two vectors (this - b)
 java.lang.String toString()
          the overridden toString() method
 VectorND toVectorND()
          method to convert this object to one representing a general Vector
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_VECTOR

public static final Vector3D NULL_VECTOR
Null vector in 3 dimensional space


UX

public static final Vector3D UX
Unit vector along X in 3 dimensional space


UY

public static final Vector3D UY
Unit vector along Y in 3 dimensional space


UZ

public static final Vector3D UZ
Unit vector along Z in 3 dimensional space

Constructor Detail

Vector3D

public Vector3D()
Creates a new instance of Vector3D


Vector3D

public Vector3D(double i,
                double j,
                double k)
Creates a new Vector3D object.

Parameters:
i - DOCUMENT ME!
j - DOCUMENT ME!
k - DOCUMENT ME!

Vector3D

public Vector3D(Point3D point)
Creates a new Vector3D object.

Parameters:
point - DOCUMENT ME!
Method Detail

add

public Vector3D add(Vector3D b)
addition of two vectors

Parameters:
b - : to be added to the current vector
Returns:
the addition of two vector

mul

public Vector3D mul(double k)
multiplication of this vector with a scalar k

Parameters:
k - k : the scalar to be multiplied to this vector
Returns:
the result !

sub

public Vector3D sub(Vector3D b)
substraction of two vectors (this - b)

Parameters:
b - : to be substracted from the current vector
Returns:
the substraction of two vector

dot

public double dot(Vector3D b)
The dot product of two vectors (a.b)

Parameters:
b - vector with which the dot product is to be evaluated
Returns:
a double value which is the result of the dot product

cross

public Vector3D cross(Vector3D b)
The cross product of two vectors (a.b). The corss product is only valid if both the vectors are in R^3 space.

Parameters:
b - vector with which the cross product is to be evaluated
Returns:
the result of the cross product

magnitude

public double magnitude()
The magnitude of this vector

Returns:
the magnitude (length) of this vector.

angleWith

public double angleWith(Vector3D b)
Find the angle made with the vector.

Parameters:
b - DOCUMENT ME!
Returns:
the angle in radians

normalize

public Vector3D normalize()
get the normalized form of this vector

Returns:
the normalized form of this vector

negate

public Vector3D negate()
negate this vector

Returns:
the reverse vector

clone

public java.lang.Object clone()
clone this vector ;) Cloning is getting interesting! :)

Overrides:
clone in class java.lang.Object
Returns:
the clone

toVectorND

public VectorND toVectorND()
method to convert this object to one representing a general Vector

Returns:
Vector the converted form

toString

public java.lang.String toString()
the overridden toString() method

Overrides:
toString in class java.lang.Object
Returns:
DOCUMENT ME!

equals

public boolean equals(java.lang.Object obj)
overloaded equals() method

Overrides:
equals in class java.lang.Object
Parameters:
obj - DOCUMENT ME!
Returns:
DOCUMENT ME!

hashCode

public int hashCode()
overriden hashCode() method

Overrides:
hashCode in class java.lang.Object
Returns:
int - the hashCode

getI

public double getI()
Getter for property i.

Returns:
Value of property i.

setI

public void setI(double i)
Setter for property i.

Parameters:
i - New value of property i.

getJ

public double getJ()
Getter for property j.

Returns:
Value of property j.

setJ

public void setJ(double j)
Setter for property j.

Parameters:
j - New value of property j.

getK

public double getK()
Getter for property k.

Returns:
Value of property k.

setK

public void setK(double k)
Setter for property k.

Parameters:
k - New value of property k.