Class JsVect3D

java.lang.Object
  extended byJsVect3D

public class JsVect3D
extends java.lang.Object


Constructor Summary
JsVect3D(double[] Xyz)
          Construtor for Js Vects
JsVect3D(double x, double y, double z)
          Construtor for Js Vects
 
Method Summary
 JsVect3D add(JsVect3D v2)
          Add two 3 dimensional vectors.
 JsVect3D com(int a, int b, JsVect3D v2)
          Compute a vector linear combination of two double precision, 3-dimensional vectors
 JsVect3D com3(int a, int b, int c, JsVect3D v2, JsVect3D v3)
          This subroutine computes the vector linear combination a*v1 + b*v2 + c*v3 of double precision, 3-dimensional vectors.
 JsVect3D cross(JsVect3D v2)
          Compute the cross product of two 3-dimensional vectors
 double dist(JsVect3D v2)
          Return the distance between two three-dimensional vectors
 double dot(JsVect3D v2)
          Compute the dot product of two double precision, 3-dimensional vectors
 double[] getData()
          Accesor for Js Vects
 double[] getVect()
          Accesor for Js Vects
 double getVect(int n)
           
 JsVect3D hat()
          Find the unit vector along a double precision 3-dimensional vector
 JsVect3D negate()
          Negate a double precision 3-dimensional vector
 double norm()
          Compute the magnitude of a double precision, 3-dimensional vector
 JsVect3D perp(JsVect3D v2)
          Find the component of a vector that is perpendicular to a second vector.
 JsVect3D proj(JsPlane plane)
          Project a vector onto a specified plane, orthogonally
 JsVect3D proj(JsPlane projpl, JsPlane invpl)
          Find the vector in a specified plane that maps to a specified vector in another plane under orthogonal projection
 JsVect3D proj(JsVect3D v2)
          finds the projection of one vector onto another vector.
 double rel(JsVect3D v2)
          RReturn the relative difference between two 3-dimensional vectors
 JsVect3D rot(JsVect3D axis, double angle)
          Rotate a vector about a specified axis vector by a specified angle and return the rotated vector
 JsVect3D scl(double scale)
          Multiply a scalar and a 3-dimensional double precision vector
 double sep(JsVect3D v2)
          Find the separation angle in radians between two double precision, 3-dimensional vectors.
 JsVect3D sub(JsVect3D v2)
          Sub two 3 dimensional vectors.
 JsVect3D tm(JsMat3D m)
          Multiply the transpose of a 3-dimensional column vector, a 3x3 matrix, and a 3-dimensional column vector
 JsVect toJsVect()
          Return the JsVect Corresponding to the JsVect3D
 boolean zero()
          Indicate whether a 3-vector is the zero vector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsVect3D

public JsVect3D(double x,
                double y,
                double z)
Construtor for Js Vects

Parameters:
x - the x component of the vector
y - the y component of the vector
z - the z component of the vector

JsVect3D

public JsVect3D(double[] Xyz)
Construtor for Js Vects

Method Detail

getVect

public double getVect(int n)
Parameters:
n - the indice of component of the vector to get
Returns:
value the value of the N component

toJsVect

public JsVect toJsVect()
Return the JsVect Corresponding to the JsVect3D

Returns:
value the value of the N component

getVect

public double[] getVect()
Accesor for Js Vects

Returns:
value the values of the vector

getData

public double[] getData()
Accesor for Js Vects

Returns:
value the values of the vector

add

public JsVect3D add(JsVect3D v2)
             throws java.lang.Exception
Add two 3 dimensional vectors.

Parameters:
v2 - the vector to be added
Returns:
This is vector sum of v1 and v2. vout may overwrite either v1 or v2.
Throws:
java.lang.Exception

cross

public JsVect3D cross(JsVect3D v2)
               throws java.lang.Exception
Compute the cross product of two 3-dimensional vectors

Parameters:
v2 - the vector to be added
Returns:
This variable represents the cross product of v1 and v2.
Throws:
java.lang.Exception

dist

public double dist(JsVect3D v2)
            throws java.lang.Exception
Return the distance between two three-dimensional vectors

Parameters:
v2 - the vector to be added
Returns:
The function returns the distance between v1 and v2. This is defined as
|| v1 - v2 ||,
where || x || indicates the Euclidean norm of the vector x
Throws:
java.lang.Exception

dot

public double dot(JsVect3D v2)
           throws java.lang.Exception
Compute the dot product of two double precision, 3-dimensional vectors

Parameters:
v2 - the vector to be dotted
Returns:
The function returns the value of the dot product of v1 and v2
Throws:
java.lang.Exception

hat

public JsVect3D hat()
             throws java.lang.Exception
Find the unit vector along a double precision 3-dimensional vector

Returns:
vout contains the unit vector in the direction of v1. If v1 represents the zero vector, then vout will also be the zero vector. vout may overwrite v1.
Throws:
java.lang.Exception

com3

public JsVect3D com3(int a,
                     int b,
                     int c,
                     JsVect3D v2,
                     JsVect3D v3)
              throws java.lang.Exception
This subroutine computes the vector linear combination a*v1 + b*v2 + c*v3 of double precision, 3-dimensional vectors.

Parameters:
v2 - the vector to be added
Throws:
java.lang.Exception

com

public JsVect3D com(int a,
                    int b,
                    JsVect3D v2)
             throws java.lang.Exception
Compute a vector linear combination of two double precision, 3-dimensional vectors

Parameters:
v2 - the vector to be added
Throws:
java.lang.Exception

negate

public JsVect3D negate()
                throws java.lang.Exception
Negate a double precision 3-dimensional vector

Returns:
This will be the negation (additive inverse) of v1. It is a 3-dimensional, double precision vector
Throws:
java.lang.Exception

norm

public double norm()
            throws java.lang.Exception
Compute the magnitude of a double precision, 3-dimensional vector

Returns:
The function returns the magnitude of v1 calculated in a numerically stable way
Throws:
java.lang.Exception

perp

public JsVect3D perp(JsVect3D v2)
              throws java.lang.Exception
Find the component of a vector that is perpendicular to a second vector. All vectors are 3-dimensional

Returns:
is a double precision, 3-dimensional vector containing the the component of a that is orthogonal to b. p may overwrite either a or b.
Throws:
java.lang.Exception

proj

public JsVect3D proj(JsPlane plane)
              throws java.lang.Exception
Project a vector onto a specified plane, orthogonally

Returns:
the vector resulting from the orthogonal projection of vin onto plane
Throws:
java.lang.Exception

proj

public JsVect3D proj(JsPlane projpl,
                     JsPlane invpl)
              throws java.lang.Exception
Find the vector in a specified plane that maps to a specified vector in another plane under orthogonal projection

Parameters:
projpl - plane containing the vector
invpl - plane containing the inverse image of the vector under orthogonal projection onto projpl
Returns:
the vector resulting from the orthogonal projection of vin onto plane
Throws:
java.lang.Exception

proj

public JsVect3D proj(JsVect3D v2)
              throws java.lang.Exception
finds the projection of one vector onto another vector. All vectors are 3-dimensional

Parameters:
v2 - the vector to be added
Returns:
is a double precision, 3-dimensional vector containing the projection of a onto b
Throws:
java.lang.Exception

rel

public double rel(JsVect3D v2)
           throws java.lang.Exception
RReturn the relative difference between two 3-dimensional vectors

Parameters:
v2 - the vector to be added
Returns:
the relative difference between V1 and V2.
It is defined as:
|| v1 - v2 ||
vrel_c = ----------------------
max ( ||v1||, ||v2|| )

where || x || indicates the Euclidean norm of the vector x ( ||x|| = sqrt( x . x ) ).

vrel_c assumes values in the range [0,2]. If both v1 and v2 are zero vectors then vrel_c is defined to be zero.
Throws:
java.lang.Exception

rot

public JsVect3D rot(JsVect3D axis,
                    double angle)
             throws java.lang.Exception
Rotate a vector about a specified axis vector by a specified angle and return the rotated vector

Returns:
is the result of rotating v about axis by theta. If axis is the zero vector, r = v
Throws:
java.lang.Exception

scl

public JsVect3D scl(double scale)
             throws java.lang.Exception
Multiply a scalar and a 3-dimensional double precision vector

Returns:
This is a 3-dimensional, double precision vector which is the scalar multiple of v1. vout = s*v1
Throws:
java.lang.Exception

sep

public double sep(JsVect3D v2)
           throws java.lang.Exception
Find the separation angle in radians between two double precision, 3-dimensional vectors. This angle is defined as zero if either vector is zero

Parameters:
v2 - the vector to be added
Returns:
is the angle between v1 and v2 expressed in radians. sep is strictly non-negative. If either v1 or v2 is the zero vector, then vsep_c is defined to be 0 radians
Throws:
java.lang.Exception

sub

public JsVect3D sub(JsVect3D v2)
             throws java.lang.Exception
Sub two 3 dimensional vectors.

Parameters:
v2 - the vector to be added
Returns:
This is vector diff of v1 and v2. vout may overwrite either v1 or v2.
Throws:
java.lang.Exception

zero

public boolean zero()
             throws java.lang.Exception
Indicate whether a 3-vector is the zero vector

Returns:
The function returns the value TRUE if and only if v is the zero vector
Throws:
java.lang.Exception

tm

public JsVect3D tm(JsMat3D m)
            throws java.lang.Exception
Multiply the transpose of a 3-dimensional column vector, a 3x3 matrix, and a 3-dimensional column vector

Returns:
This is vector diff of v1 and v2. vout may overwrite either v1 or v2.
Throws:
java.lang.Exception