org.jscience.chemistry.gui.extended.geometry
Class GeoVector3D

java.lang.Object
  extended by org.jscience.chemistry.gui.extended.geometry.GeoVector3D

public class GeoVector3D
extends java.lang.Object

A geometric vector class that provides vector computations: length, normalize, dot and cross. note: Vector is a coordinate independent concept. Translating a vector in 3D (or 2D) space yields the same vector.

See Also:
Point3D

Field Summary
protected  double x
          X component of the vector
protected  double y
          Y component of the vector
protected  double z
          Z component of the vector
 
Constructor Summary
GeoVector3D()
          Default constructor, all component are 0.0
GeoVector3D(double x, double y, double z)
          Full constructor
GeoVector3D(GeoVector3D gv)
          copy constructor
GeoVector3D(Point3D p1, Point3D p2)
          constructor
 
Method Summary
 void add(GeoVector3D gv)
          add a vector to this vector
 GeoVector3D cross(GeoVector3D gv)
          cross product with another vector
 double dot(GeoVector3D gv)
          dot product with another vector
 double getX()
          Return component x
 double getY()
          Return component y
 double getZ()
          Return component z
 double length()
          calculate the length of the vector
 void minus(GeoVector3D gv)
          subtract a vector from this vector
 void normalize()
          change the vector's length so that it becomes a unit vector
 void scale(double factor)
          scale the vector by a factor
 void setX(double x)
          Set component x
 void setY(double y)
          Set component y
 void setZ(double z)
          Set component z
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

protected double x
X component of the vector


y

protected double y
Y component of the vector


z

protected double z
Z component of the vector

Constructor Detail

GeoVector3D

public GeoVector3D()
Default constructor, all component are 0.0


GeoVector3D

public GeoVector3D(double x,
                   double y,
                   double z)
Full constructor

Parameters:
x - DOCUMENT ME!
y - DOCUMENT ME!
z - DOCUMENT ME!

GeoVector3D

public GeoVector3D(Point3D p1,
                   Point3D p2)
constructor

Parameters:
p1 - start point of the vector
p2 - end point of the vector

GeoVector3D

public GeoVector3D(GeoVector3D gv)
copy constructor

Parameters:
gv - the vector to be copied
Method Detail

length

public double length()
calculate the length of the vector

Returns:
DOCUMENT ME!

normalize

public void normalize()
change the vector's length so that it becomes a unit vector


cross

public GeoVector3D cross(GeoVector3D gv)
cross product with another vector

Parameters:
gv - the other vector to cross
Returns:
(GeoVector3D) this cross gv

dot

public double dot(GeoVector3D gv)
dot product with another vector

Parameters:
gv - the other vector to dot
Returns:
the (double) this dot gv

scale

public void scale(double factor)
scale the vector by a factor

Parameters:
factor - the scaling factor

add

public void add(GeoVector3D gv)
add a vector to this vector

Parameters:
gv - the other vector to add

minus

public void minus(GeoVector3D gv)
subtract a vector from this vector

Parameters:
gv - the other vector to subtract

getX

public double getX()
Return component x

Returns:
DOCUMENT ME!

getY

public double getY()
Return component y

Returns:
DOCUMENT ME!

getZ

public double getZ()
Return component z

Returns:
DOCUMENT ME!

setX

public void setX(double x)
Set component x

Parameters:
x - x component

setY

public void setY(double y)
Set component y

Parameters:
y - y component

setZ

public void setZ(double z)
Set component z

Parameters:
z - z component