org.openmali.vecmath2.util
Class FloatUtils

java.lang.Object
  extended by org.openmali.vecmath2.util.FloatUtils

public class FloatUtils
extends java.lang.Object

This class provides static helper methods for floats to be used instead of complex objects.


Constructor Summary
FloatUtils()
           
 
Method Summary
static float angle(float v1x, float v1y, float v1z, float v2x, float v2y, float v2z)
          Returns the angle in radians between the vectors v1 and v2.
static AxisAngle3f computeRotation(float v1x, float v1y, float v1z, float v2x, float v2y, float v2z, int normalize, AxisAngle3f result)
          Computes the rotation between the vectors v1 ans v2.
static
<T extends Tuple3f>
T
cross(float v1x, float v1y, float v1z, float v2x, float v2y, float v2z, T result)
          Sets the result-vector to be the vector cross product of vectors v1 and v2.
static float dot(float v1x, float v1y, float v1z, float v2x, float v2y, float v2z)
          Computes the dot product of the vectors v1 and vector v2.
static float pointsDistance(float px1, float py1, float pz1, float px2, float py2, float pz2)
           
static float pointsDistance(Point3f p1, float px2, float py2, float pz2)
           
static float pointsDistanceSquared(float px1, float py1, float pz1, float px2, float py2, float pz2)
           
static float pointsDistanceSquared(Point3f p1, float px2, float py2, float pz2)
           
static float vectorLength(float vx, float vy, float vz)
           
static float vectorLengthSquared(float vx, float vy, float vz)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FloatUtils

public FloatUtils()
Method Detail

vectorLengthSquared

public static final float vectorLengthSquared(float vx,
                                              float vy,
                                              float vz)
Returns:
the squared length of a vector

vectorLength

public static final float vectorLength(float vx,
                                       float vy,
                                       float vz)
Returns:
the length of a vector

pointsDistanceSquared

public static final float pointsDistanceSquared(float px1,
                                                float py1,
                                                float pz1,
                                                float px2,
                                                float py2,
                                                float pz2)
Returns:
the squared distance of two points

pointsDistance

public static final float pointsDistance(float px1,
                                         float py1,
                                         float pz1,
                                         float px2,
                                         float py2,
                                         float pz2)
Returns:
the distance of two points

pointsDistanceSquared

public static final float pointsDistanceSquared(Point3f p1,
                                                float px2,
                                                float py2,
                                                float pz2)
Returns:
the squared distance of two points

pointsDistance

public static final float pointsDistance(Point3f p1,
                                         float px2,
                                         float py2,
                                         float pz2)
Returns:
the distance of two points

cross

public static final <T extends Tuple3f> T cross(float v1x,
                                                float v1y,
                                                float v1z,
                                                float v2x,
                                                float v2y,
                                                float v2z,
                                                T result)
Sets the result-vector to be the vector cross product of vectors v1 and v2.

Parameters:
v1x - the first vector
v1y - the first vector
v1z - the first vector
v2x - the second vector
v2y - the second vector
v2z - the second vector
result - the result vector
Returns:
the result vector back again

dot

public static final float dot(float v1x,
                              float v1y,
                              float v1z,
                              float v2x,
                              float v2y,
                              float v2z)
Computes the dot product of the vectors v1 and vector v2.

Parameters:
v1x - the first vector
v1y - the first vector
v1z - the first vector
v2x - the second vector
v2y - the second vector
v2z - the second vector

angle

public static final float angle(float v1x,
                                float v1y,
                                float v1z,
                                float v2x,
                                float v2y,
                                float v2z)
Returns the angle in radians between the vectors v1 and v2. The return value is constrained to the range [0,PI].

Parameters:
v1x - the first vector
v1y - the first vector
v1z - the first vector
v2x - the second vector
v2y - the second vector
v2z - the second vector
Returns:
the angle in radians in the range [0,PI]

computeRotation

public static final AxisAngle3f computeRotation(float v1x,
                                                float v1y,
                                                float v1z,
                                                float v2x,
                                                float v2y,
                                                float v2z,
                                                int normalize,
                                                AxisAngle3f result)
Computes the rotation between the vectors v1 ans v2.

Parameters:
v1x - the first vector
v1y - the first vector
v1z - the first vector
v2x - the second vector
v2y - the second vector
v2z - the second vector
normalize - normalize input vectors (bitmask)
result - the result object
Returns:
the result object back again