com.hermetica.vecmath
Class Vec3f

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

public class Vec3f
extends java.lang.Object


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

Field Detail

x

public float x
The x coordinate

y

public float y
The y coordinate

z

public float z
The z coordinate
Constructor Detail

Vec3f

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

Vec3f

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

Vec3f

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

Vec3f

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

add

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

add

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

cross

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

distance

public final float distance(Vec3f v1)
Computes the distance between this vector and vector v1

distanceSquared

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

dot

public final float dot(Vec3f v1)
Computes the dot product of this vector and vector v1

equals

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

get

public final void get(float[] 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 float length()
Returns the length of this vector

lengthSquared

public final float 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(Vec3f 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(float s)
Sets the value of this vector to the scalar multiplication of the scale factor with this.

scale

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

scaleAdd

public final void scaleAdd(float s,
                           Vec3f v1,
                           Vec3f 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(float x,
                      float y,
                      float z)
Sets the value of this vector to the specified xyz co-ordinates

set

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

set

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

set

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

sub

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

sub

public final void sub(Vec3f v1,
                      Vec3f 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 Vec3f
Overrides:
toString in class java.lang.Object