com.hermetica.vecmath
Class Vec3d

java.lang.Object
  |
  +--com.hermetica.vecmath.Vec3d

public class Vec3d
extends java.lang.Object


Field Summary
 double x
          The x coordinate
 double y
          The y coordinate
 double z
          The z coordinate
 
Constructor Summary
Vec3d()
          Constructs and initializes a Vec3d to ( 0, 0, 0 )
Vec3d(double[] ary)
          Constructs and initializes a Vec3d from the array of length 3
Vec3d(double x, double y, double z)
          Constructs and initializes a Vec3d from the specified xyz co-ordinates
Vec3d(Vec3d vec)
          Constructs and initializes a Vec3d from the specified Vec3d
 
Method Summary
 void add(Vec3d v1)
          Sets the values of this vector to the vector sum of itself and vector v1.
 void add(Vec3d v1, Vec3d v2)
          Sets the value of this vector to the vector sum of vectors v1 and v2
 void cross(Vec3d v1, Vec3d v2)
          Sets this vector to be the cross product of vectors v1 and v2
 double distance(Vec3d v1)
          Computes the distance between this vector and vector v1
 double distanceSquared(Vec3d v1)
          Computes the square of the distance between this vector and vector v1.
 double dot(Vec3d v1)
          Computes the dot product of this vector and vector v1
 boolean equals(Vec3d v1)
          Returns true if all of the data members of Vec3d v1 are equal to the corresponding data members in this Vec3d.
 void get(double[] ary)
          Gets the value of this vector and copies the values into v[]
 int hashCode()
          Returns a hash number based on the data values in this object
 double length()
          Returns the length of this vector
 double lengthSquared()
          Returns the squared length of this vector
 void negate()
          Inverts the value of this vector in place
 void negate(Vec3d v1)
          Sets the value of this vector to the inverse of vector v1
 void normalize()
          Normalizes this vector in place.
 void scale(double s)
          Sets the value of this vector to the scalar multiplication of the scale factor with this.
 void scale(double s, Vec3d v1)
          Sets the value of this vector to the scalar multiplication of vector v1.
 void scaleAdd(double s, Vec3d v1, Vec3d v2)
          Sets the value of this vector to the scalar multiplication of vector v1 plus vector v2 ( this = s * v1 + v2 ).
 void set(double[] ary)
          Sets the value of this vector to the xyz co-ordinates specified in the array of length 3.
 void set(double x, double y, double z)
          Sets the value of this vector to the specified xyz co-ordinates
 void set(Vec3d v1)
          Sets the value of this vector to the value of vector v1.
 void set(Vec3f v1)
          Sets the value of this vector to the value of vector v1
 void sub(Vec3d v1)
          Sets the value of this vector to the vector difference of itself and vector v1 ( this = this - v1 ).
 void sub(Vec3d v1, Vec3d v2)
          Sets the value of this vector to the vector difference of vectors v1 and v2 ( this = v1 - v2 ).
 java.lang.String toString()
          Returns a String that contains the values of this Vec3d
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x
The x coordinate

y

public double y
The y coordinate

z

public double z
The z coordinate
Constructor Detail

Vec3d

public Vec3d()
Constructs and initializes a Vec3d to ( 0, 0, 0 )

Vec3d

public Vec3d(double x,
             double y,
             double z)
Constructs and initializes a Vec3d from the specified xyz co-ordinates

Vec3d

public Vec3d(double[] ary)
Constructs and initializes a Vec3d from the array of length 3

Vec3d

public Vec3d(Vec3d vec)
Constructs and initializes a Vec3d from the specified Vec3d
Method Detail

add

public final void add(Vec3d v1)
Sets the values of this vector to the vector sum of itself and vector v1.

add

public final void add(Vec3d v1,
                      Vec3d v2)
Sets the value of this vector to the vector sum of vectors v1 and v2

cross

public final void cross(Vec3d v1,
                        Vec3d v2)
Sets this vector to be the cross product of vectors v1 and v2

distance

public final double distance(Vec3d v1)
Computes the distance between this vector and vector v1

distanceSquared

public final double distanceSquared(Vec3d v1)
Computes the square of the distance between this vector and vector v1.

dot

public final double dot(Vec3d v1)
Computes the dot product of this vector and vector v1

equals

public final boolean equals(Vec3d v1)
Returns true if all of the data members of Vec3d v1 are equal to the corresponding data members in this Vec3d.

get

public final void get(double[] ary)
Gets the value of this vector and copies the values into v[]

hashCode

public int hashCode()
Returns a hash number based on the data values in this object
Overrides:
hashCode in class java.lang.Object

length

public final double length()
Returns the length of this vector

lengthSquared

public final double lengthSquared()
Returns the squared length of this vector

negate

public final void negate()
Inverts the value of this vector in place

negate

public final void negate(Vec3d v1)
Sets the value of this vector to the inverse of vector v1

normalize

public final void normalize()
Normalizes this vector in place.

scale

public final void scale(double s)
Sets the value of this vector to the scalar multiplication of the scale factor with this.

scale

public final void scale(double s,
                        Vec3d v1)
Sets the value of this vector to the scalar multiplication of vector v1.

scaleAdd

public final void scaleAdd(double s,
                           Vec3d v1,
                           Vec3d v2)
Sets the value of this vector to the scalar multiplication of vector v1 plus vector v2 ( this = s * v1 + v2 ).

set

public final void set(double x,
                      double y,
                      double z)
Sets the value of this vector to the specified xyz co-ordinates

set

public final void set(double[] ary)
Sets the value of this vector to the xyz co-ordinates specified in the array of length 3.

set

public final void set(Vec3d v1)
Sets the value of this vector to the value of vector v1.

set

public final void set(Vec3f v1)
Sets the value of this vector to the value of vector v1

sub

public final void sub(Vec3d v1)
Sets the value of this vector to the vector difference of itself and vector v1 ( this = this - v1 ).

sub

public final void sub(Vec3d v1,
                      Vec3d v2)
Sets the value of this vector to the vector difference of vectors v1 and v2 ( this = v1 - v2 ).

toString

public java.lang.String toString()
Returns a String that contains the values of this Vec3d
Overrides:
toString in class java.lang.Object