Class pmr.euclid.Vector3
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class pmr.euclid.Vector3

java.lang.Object
   |
   +----pmr.euclid.Status
           |
           +----pmr.euclid.Vector3

public class Vector3
extends Status
Vector3 - 3-dimensional vector

A vector has thre components giving it a length and a direction (whose sign is important),but no position. Vectors are often normalised to unti length.

Vectors and points are very closely related and some people use them interchangeabley. A Point3 has a position and cannot be normlaised. In very many routines, however, Vectors and Points can either be used interchangeably, or there are equivalent routines or they can be converted using cross-constructors. (They cannot be interconverted through casts).

The default vector is 0.0, 0.0, 0.0. Some operations on this will result in ZerolengthVector Exceptions.

Author:
(C) P. Murray-Rust, 1996

Constructor Index

 o Vector3()
null constructor
 o Vector3(Choice3)
axial unit vector constructor: unit vectors along X, Y, Z axes
 o Vector3(double, double, double)
formed from vector components
 o Vector3(double[])
formed from vector components
 o Vector3(Point3)
make a vector from a point
 o Vector3(RealArray)
copy constructor from RealArray:
 o Vector3(Vector3)
copy constructor:

Method Index

 o clone(Point3)
from Point3
 o clone(Vector3)
 o cross(Vector3)
Vector product
 o dot(double[])
dot product - protected
 o dot(Vector3)
dot product
 o elementAt(int)
subscript operator: counts from ZERO
 o equals(Vector3)
are two vectors equal lengths?
 o getAngleMadeWith(Vector3)
angle between two vectors
 o getArray()
get the vector components
 o getLength()
return vector length
 o getScalarTripleProduct(Vector3, Vector3)
 o getUnitVector()
 o isIdenticalTo(Vector3)
are two vectors identical?
 o isZero()
is a vector null?
 o longerThan(Vector3)
vector length > vector length?
 o main(String[])
tests Vector3 routines = new Vector3
 o multiplyBy(double)
scalar multiplication v = v*f
 o negative()
 o normalise()
Normalise vector
 o plus(Vector3)
 o projectOnto(Vector3)
projection of this onto v3
 o setElementAt(int, double)
subscript operator: counts from ZERO
 o shallowCopy(Vector3)
shallowCopy
 o subtract(Vector3)
 o toString()
 o transform(Transform3)
transform a vector

Constructors

 o Vector3
  public Vector3()
null constructor
 o Vector3
  public Vector3(double x,
                 double y,
                 double z)
formed from vector components
 o Vector3
  public Vector3(double array[])
formed from vector components
 o Vector3
  public Vector3(Choice3 axis)
axial unit vector constructor: unit vectors along X, Y, Z axes
 o Vector3
  public Vector3(Vector3 v)
copy constructor:
 o Vector3
  public Vector3(RealArray f)
copy constructor from RealArray:
 o Vector3
  public Vector3(Point3 p)
make a vector from a point

Methods

 o shallowCopy
  public void shallowCopy(Vector3 v)
shallowCopy
 o clone
  public Vector3 clone(Vector3 v)
 o clone
  public Vector3 clone(Point3 p)
from Point3
 o getArray
  public double[] getArray()
get the vector components
 o equals
  public boolean equals(Vector3 v)
are two vectors equal lengths?
 o longerThan
  public boolean longerThan(Vector3 v)
vector length > vector length?
 o multiplyBy
  public Vector3 multiplyBy(double f)
scalar multiplication v = v*f
 o plus
  public Vector3 plus(Vector3 v3)
 o subtract
  public Vector3 subtract(Vector3 v3)
 o negative
  public Vector3 negative()
 o elementAt
  public double elementAt(int n)
subscript operator: counts from ZERO
 o setElementAt
  public Vector3 setElementAt(int n,
                              double f)
subscript operator: counts from ZERO
 o isIdenticalTo
  public boolean isIdenticalTo(Vector3 v)
are two vectors identical?
 o isZero
  public boolean isZero()
is a vector null?
 o transform
  public Vector3 transform(Transform3 t)
transform a vector
 o cross
  public Vector3 cross(Vector3 v3)
Vector product
 o normalise
  public Vector3 normalise()
Normalise vector
 o getUnitVector
  public Vector3 getUnitVector()
 o getLength
  public double getLength()
return vector length
 o dot
  public double dot(Vector3 v3)
dot product
 o dot
  protected double dot(double v3[])
dot product - protected
 o getAngleMadeWith
  public Angle getAngleMadeWith(Vector3 v2) throws ZeroLengthVectorException
angle between two vectors
Throws: ZeroLengthVectorException
v2 or this is zero length
 o getScalarTripleProduct
  public double getScalarTripleProduct(Vector3 v2,
                                       Vector3 v3)
 o projectOnto
  public Vector3 projectOnto(Vector3 v3) throws ZeroLengthVectorException
projection of this onto v3
Throws: ZeroLengthVectorException
v2 or this is zero length
 o toString
  public String toString()
Overrides:
toString in class Object
 o main
  public static void main(String args[])
tests Vector3 routines = new Vector3

All Packages  Class Hierarchy  This Package  Previous  Next  Index