espresso3d.engine.lowlevel.vector
Class E3DVector3F

java.lang.Object
  extended byespresso3d.engine.lowlevel.vector.E3DVector3F

public class E3DVector3F
extends java.lang.Object

Author:
espresso3d 3D floating point vector class.

Constructor Summary
E3DVector3F()
           
E3DVector3F(double x, double y, double z)
           
E3DVector3F(E3DVector3F toCopy)
           
 
Method Summary
 E3DVector3F add(E3DVector3F translationAmt)
          Return a new E3DVector3F with this + translationAmt added
 void addEqual(E3DVector3F translationAmt)
          Set this vector to this + translationAmt
 double angleBetweenDegrees(E3DVector3F otherVec)
          Get the angle between this vector and otherVec in degrees
 double angleBetweenRads(E3DVector3F otherVec)
          Get the angle between this vector and otherVec in radians
 E3DVector3F crossProduct(E3DVector3F otherVec)
          Get the cross product of this vector x otherVec
 double dotProduct(E3DVector3F otherVec)
          Get the dot product of this vector and otherVec
 boolean equals(double x, double y, double z)
           
 boolean equals(E3DVector3F vec)
           
 java.nio.FloatBuffer getFloatBuffer()
           
 double getLength()
          Get the actual length of this vector
 double getLengthSquared()
          Get the length of the vector squared.
 double getX()
           
 double getY()
           
 double getZ()
           
 E3DVector3F multiply(E3DVector3F multiplyAmt)
          Get a new vector with thisVector * multiplyAmt
 void multiplyEqual(E3DVector3F multiplyAmt)
          Set this vector equal to this * multiplyAmt
 E3DVector3F normalise()
          Get a new vector that is the normalised version of this vector
 void normaliseEqual()
          Normalise this vector
 E3DVector3F rotate(double angle, E3DVector3F aroundVec)
          Get a new vector that is rotated angle radians around the around vec
 void rotateEqual(double angle, E3DVector3F aroundVec)
          Rotate this vector angle radians around the aroundVec
 E3DVector3F scale(double scaleAmt)
          Return a new vector of this vector scaled by scaleAmt
 void scaleEqual(double scaleAmt)
          Set this vector to this scaled by scaleAmt
 void set(double x, double y, double z)
          Set the coordinates to x, y, and z
 void set(E3DVector3F newVec)
          Set the x, y, and z coord of this vec to copies of the passed in vector
 void setX(double x)
           
 void setY(double y)
           
 void setZ(double z)
           
 E3DVector3F subtract(E3DVector3F translationAmt)
          Return a new E3DVector3F with this - translationAmt subtract
 void subtractEqual(E3DVector3F translationAmt)
          Set this vector to this - translationAmt
 java.lang.String toString()
          Get a string of vertex coordinates for this vector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

E3DVector3F

public E3DVector3F()

E3DVector3F

public E3DVector3F(E3DVector3F toCopy)

E3DVector3F

public E3DVector3F(double x,
                   double y,
                   double z)
Method Detail

equals

public boolean equals(E3DVector3F vec)

equals

public boolean equals(double x,
                      double y,
                      double z)

getX

public double getX()
Returns:
Returns the x.

setX

public void setX(double x)
Parameters:
x - The x to set.

getY

public double getY()
Returns:
Returns the y.

setY

public void setY(double y)
Parameters:
y - The y to set.

getZ

public double getZ()
Returns:
Returns the z.

setZ

public void setZ(double z)
Parameters:
z - The z to set.

set

public void set(E3DVector3F newVec)
Set the x, y, and z coord of this vec to copies of the passed in vector

Parameters:
newVec -

set

public void set(double x,
                double y,
                double z)
Set the coordinates to x, y, and z

Parameters:
x -
y -
z -

add

public E3DVector3F add(E3DVector3F translationAmt)
Return a new E3DVector3F with this + translationAmt added

Parameters:
translationAmt -
Returns:

addEqual

public void addEqual(E3DVector3F translationAmt)
Set this vector to this + translationAmt

Parameters:
translationAmt -

subtract

public E3DVector3F subtract(E3DVector3F translationAmt)
Return a new E3DVector3F with this - translationAmt subtract

Parameters:
translationAmt -
Returns:

subtractEqual

public void subtractEqual(E3DVector3F translationAmt)
Set this vector to this - translationAmt

Parameters:
translationAmt -

scale

public E3DVector3F scale(double scaleAmt)
Return a new vector of this vector scaled by scaleAmt

Parameters:
scaleAmt -
Returns:

scaleEqual

public void scaleEqual(double scaleAmt)
Set this vector to this scaled by scaleAmt


multiply

public E3DVector3F multiply(E3DVector3F multiplyAmt)
Get a new vector with thisVector * multiplyAmt

Parameters:
multiplyAmt -
Returns:

multiplyEqual

public void multiplyEqual(E3DVector3F multiplyAmt)
Set this vector equal to this * multiplyAmt

Parameters:
multiplyAmt -

rotate

public E3DVector3F rotate(double angle,
                          E3DVector3F aroundVec)
Get a new vector that is rotated angle radians around the around vec

Parameters:
angle - Angle to rotate in radians
aroundVec - Vector that creates the central axis to rotate around
Returns:
Returns a new vector that is this vector rotated angle radians around the around vec

rotateEqual

public void rotateEqual(double angle,
                        E3DVector3F aroundVec)
Rotate this vector angle radians around the aroundVec

Parameters:
angle -
aroundVec - Vector that creates the central axis to rotate around

dotProduct

public double dotProduct(E3DVector3F otherVec)
Get the dot product of this vector and otherVec

Parameters:
otherVec -
Returns:

getLengthSquared

public double getLengthSquared()
Get the length of the vector squared. Actual length needs takes the sqrt of this value.

Returns:

getLength

public double getLength()
Get the actual length of this vector

Returns:

angleBetweenDegrees

public double angleBetweenDegrees(E3DVector3F otherVec)
Get the angle between this vector and otherVec in degrees

Parameters:
otherVec -
Returns:

angleBetweenRads

public double angleBetweenRads(E3DVector3F otherVec)
Get the angle between this vector and otherVec in radians

Parameters:
otherVec -
Returns:

normalise

public E3DVector3F normalise()
Get a new vector that is the normalised version of this vector

Returns:

normaliseEqual

public void normaliseEqual()
Normalise this vector


crossProduct

public E3DVector3F crossProduct(E3DVector3F otherVec)
Get the cross product of this vector x otherVec

Parameters:
otherVec -
Returns:

getFloatBuffer

public java.nio.FloatBuffer getFloatBuffer()

toString

public java.lang.String toString()
Get a string of vertex coordinates for this vector