org.jscience.physics.solids.geom
Class AtlasVector

java.lang.Object
  extended by org.jscience.physics.solids.AtlasObject
      extended by org.jscience.physics.solids.geom.AtlasVector
All Implemented Interfaces:
java.lang.Comparable

public class AtlasVector
extends AtlasObject

A spatial direction and magnitude.


Field Summary
protected static java.lang.String TYPE
          DOCUMENT ME!
 
Constructor Summary
AtlasVector()
          Creates a new vector (0.,0.,0.) in the global coordinate system.
AtlasVector(AtlasCoordSys cs, double[] vals)
          Creates a new vector (x,y,z) in the global coordinate system.
AtlasVector(AtlasCoordSys cs, double x, double y, double z)
          Creates a new vector (x,y,z) in the global coordinate system.
AtlasVector(double[] vals)
          Creates a new vector (x,y,z) in the global coordinate system.
AtlasVector(double x, double y, double z)
          Creates a new vector (x,y,z) in the global coordinate system.
 
Method Summary
 AtlasVector clone()
          Returns a clone of the vector
 double computeAngle(AtlasVector v)
          Computes the angle between the two vectors.
 double computeMagnitude()
          Returns the magnitude of the vector.
 AtlasVector cross(AtlasVector v)
          Computes cross product between the two vectors.
 double dot(AtlasVector v)
          Computes dot product between the two vectors.
 double[] getComponents(AtlasCoordSys coordSys)
          Returns the components of the vector in the specified coordinate system.
 AtlasCoordSys getCoordSys()
          Returns the reference coordsys for this vector.
 double[] getGlobalDirection()
          Returns the location in the global coordinate system.
 java.lang.String getType()
          DOCUMENT ME!
 boolean isEquivalent(AtlasVector v, double tolerance)
          Determines whether the two vectors have the same direction
 boolean isParallel(AtlasVector v)
          Determines whether the two vectors are parallel.
 void normalize()
          Normalizes the vector in place
 void scale(double s)
          Scales the vector magnitude.
 java.lang.String toString()
          DOCUMENT ME!
 
Methods inherited from class org.jscience.physics.solids.AtlasObject
compareTo, equals, getId, getParentModel, loadJDOMElement, populateGeometry, setId, setParentModel, unloadJDOMElement
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

protected static java.lang.String TYPE
DOCUMENT ME!

Constructor Detail

AtlasVector

public AtlasVector()
Creates a new vector (0.,0.,0.) in the global coordinate system.


AtlasVector

public AtlasVector(double x,
                   double y,
                   double z)
Creates a new vector (x,y,z) in the global coordinate system.


AtlasVector

public AtlasVector(double[] vals)
Creates a new vector (x,y,z) in the global coordinate system.


AtlasVector

public AtlasVector(AtlasCoordSys cs,
                   double x,
                   double y,
                   double z)
Creates a new vector (x,y,z) in the global coordinate system.


AtlasVector

public AtlasVector(AtlasCoordSys cs,
                   double[] vals)
Creates a new vector (x,y,z) in the global coordinate system.

Method Detail

getType

public java.lang.String getType()
DOCUMENT ME!

Specified by:
getType in class AtlasObject
Returns:
DOCUMENT ME!

getGlobalDirection

public double[] getGlobalDirection()
Returns the location in the global coordinate system. The returned array is three elements long, in the order of x,y,z.

Returns:
DOCUMENT ME!

getComponents

public double[] getComponents(AtlasCoordSys coordSys)
Returns the components of the vector in the specified coordinate system.

Parameters:
coordSys - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.UnsupportedOperationException - DOCUMENT ME!

getCoordSys

public AtlasCoordSys getCoordSys()
Returns the reference coordsys for this vector.

Returns:
DOCUMENT ME!

computeMagnitude

public double computeMagnitude()
Returns the magnitude of the vector.

Returns:
DOCUMENT ME!

computeAngle

public double computeAngle(AtlasVector v)
Computes the angle between the two vectors.

Parameters:
v - DOCUMENT ME!
Returns:
DOCUMENT ME!

dot

public double dot(AtlasVector v)
Computes dot product between the two vectors.

Parameters:
v - DOCUMENT ME!
Returns:
DOCUMENT ME!

normalize

public void normalize()
Normalizes the vector in place


scale

public void scale(double s)
Scales the vector magnitude. This is the same as multipling all components by the scale.

Parameters:
s - DOCUMENT ME!

isEquivalent

public boolean isEquivalent(AtlasVector v,
                            double tolerance)
Determines whether the two vectors have the same direction

Parameters:
v - DOCUMENT ME!
tolerance - DOCUMENT ME!
Returns:
DOCUMENT ME!

cross

public AtlasVector cross(AtlasVector v)
Computes cross product between the two vectors.

Parameters:
v - DOCUMENT ME!
Returns:
DOCUMENT ME!

toString

public java.lang.String toString()
DOCUMENT ME!

Overrides:
toString in class AtlasObject
Returns:
DOCUMENT ME!

clone

public AtlasVector clone()
Returns a clone of the vector

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

isParallel

public boolean isParallel(AtlasVector v)
Determines whether the two vectors are parallel. Uses a tolerance of .0001 radians

Parameters:
v - DOCUMENT ME!
Returns:
DOCUMENT ME!