org.openmali.vecmath2
Class Coord3f

java.lang.Object
  extended by org.openmali.vecmath2.TupleNf<Tuple3f>
      extended by org.openmali.vecmath2.Tuple3f
          extended by org.openmali.vecmath2.Vector3f
              extended by org.openmali.vecmath2.Coord3f
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, TupleInterface<Tuple3f>, VectorInterface<Tuple3f,Vector3f>

public class Coord3f
extends Vector3f
implements java.io.Externalizable

A Coord3f combines the functionality of a vector with the functionality of a point. Transformations on a Coord3f are as a point, so translation is taken into account. You can also find the distance of one Coord3f to another.

Author:
David Yazel, Marvin Froehlich (aka Qudus)
See Also:
Serialized Form

Field Summary
static Coord3f ZERO
           
 
Fields inherited from class org.openmali.vecmath2.Vector3f
NEGATIVE_X_AXIS, NEGATIVE_Y_AXIS, NEGATIVE_Z_AXIS, POSITIVE_X_AXIS, POSITIVE_Y_AXIS, POSITIVE_Z_AXIS
 
Fields inherited from class org.openmali.vecmath2.TupleNf
isDirty, roTrick, values
 
Constructor Summary
  Coord3f()
           
protected Coord3f(boolean readOnly)
           
protected Coord3f(boolean readOnly, float[] values)
           
protected Coord3f(boolean readOnly, float x, float y, float z)
           
protected Coord3f(boolean readOnly, Tuple3f tuple)
           
  Coord3f(float[] values)
           
  Coord3f(float x, float y, float z)
           
  Coord3f(Tuple3f tuple)
           
 
Method Summary
 float angle(Tuple3f v2)
          Returns the angle in radians between this vector and the vector parameter; the return value is constrained to the range [0, PI].
 void cross(Tuple3f v1, Tuple3f v2)
          Sets this vector to be the vector cross product of vectors v1 and v2.
static Coord3f crossNew(Coord3f c1, Coord3f c2)
           
 float distance(Tuple3f a)
           
 float distance(Tuple3f a, Tuple3f b)
           
 float distanceSquared(Tuple3f a)
           
 float distanceSquared(Tuple3f a, Tuple3f b)
           
 float dot(Tuple3f v2)
          Computes the dot product of the this vector and vector v2.
static Coord3f fromPool()
          Allocates an Coord3f instance from the pool.
static Coord3f fromPool(float x, float y, float z)
          Allocates an Coord3f instance from the pool.
static Coord3f fromPool(Tuple3f tuple)
          Allocates an Coord3f instance from the pool.
 void get(Coord3f buffer)
           
static Coord3f newReadOnly()
           
static Coord3f newReadOnly(float[] values)
           
static Coord3f newReadOnly(float x, float y, float z)
           
static Coord3f newReadOnly(Tuple3f tuple)
           
 void normalize(Tuple3f vector)
          Sets the value of this vector to the normalization of vector v1.
static Coord3f scaleNew(Coord3f c1, float scale)
           
 void set(Coord3f coord)
           
static Coord3f subNew(Coord3f c1, Coord3f c2)
           
static void toPool(Coord3f o)
          Stores the given Coord3f instance in the pool.
 
Methods inherited from class org.openmali.vecmath2.Vector3f
angle, cross, dot, length, lengthSquared, normalize, normalize, toPool
 
Methods inherited from class org.openmali.vecmath2.Tuple3f
add, addX, addY, addZ, clone, div, divX, divY, divZ, equals, getX, getY, getZ, mul, mulX, mulY, mulZ, scale, set, setX, setY, setZ, sub, subX, subY, subZ, toPool
 
Methods inherited from class org.openmali.vecmath2.TupleNf
absolute, absolute, add, add, addValue, clamp, clamp, clampMax, clampMax, clampMin, clampMin, deserialize, div, divValue, epsilonEquals, equals, fill, get, get, getSerializationBufferSize, getSize, getValue, hashCode, interpolate, interpolate, isDirty, isReadOnly, mul, mulValue, negate, negate, readExternal, round, round, scale, scale, scaleAdd, scaleAdd, serialize, set, set, setClean, setValue, setZero, sub, sub, subValue, toString, writeExternal, writeToBuffer, writeToBuffer
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
 
Methods inherited from interface org.openmali.vecmath2.TupleInterface
absolute, absolute, add, add, addValue, clamp, clamp, clampMax, clampMax, clampMin, clampMin, div, divValue, epsilonEquals, fill, get, get, getSize, getValue, interpolate, interpolate, isDirty, isReadOnly, mul, mulValue, negate, negate, round, round, scale, scale, scaleAdd, scaleAdd, set, set, setClean, setValue, setZero, sub, sub, subValue
 

Field Detail

ZERO

public static final Coord3f ZERO
Constructor Detail

Coord3f

protected Coord3f(boolean readOnly,
                  float x,
                  float y,
                  float z)

Coord3f

protected Coord3f(boolean readOnly,
                  float[] values)

Coord3f

protected Coord3f(boolean readOnly,
                  Tuple3f tuple)

Coord3f

protected Coord3f(boolean readOnly)

Coord3f

public Coord3f(float x,
               float y,
               float z)

Coord3f

public Coord3f(float[] values)

Coord3f

public Coord3f(Tuple3f tuple)

Coord3f

public Coord3f()
Method Detail

set

public final void set(Coord3f coord)

get

public final void get(Coord3f buffer)

distanceSquared

public final float distanceSquared(Tuple3f a,
                                   Tuple3f b)

distanceSquared

public final float distanceSquared(Tuple3f a)

distance

public final float distance(Tuple3f a)

distance

public final float distance(Tuple3f a,
                            Tuple3f b)

normalize

public final void normalize(Tuple3f vector)
Sets the value of this vector to the normalization of vector v1.

Parameters:
vector - the un-normalized vector

cross

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

Parameters:
v1 - the first vector
v2 - the second vector

dot

public final float dot(Tuple3f v2)
Computes the dot product of the this vector and vector v2.

Parameters:
v2 - the other vector

angle

public final float angle(Tuple3f v2)
Returns the angle in radians between this vector and the vector parameter; the return value is constrained to the range [0, PI].

Parameters:
v2 - the other vector
Returns:
the angle in radians in the range [0, PI]

subNew

public static final Coord3f subNew(Coord3f c1,
                                   Coord3f c2)

crossNew

public static final Coord3f crossNew(Coord3f c1,
                                     Coord3f c2)

scaleNew

public static final Coord3f scaleNew(Coord3f c1,
                                     float scale)

newReadOnly

public static Coord3f newReadOnly(float x,
                                  float y,
                                  float z)

newReadOnly

public static Coord3f newReadOnly(float[] values)

newReadOnly

public static Coord3f newReadOnly(Tuple3f tuple)

newReadOnly

public static Coord3f newReadOnly()

fromPool

public static Coord3f fromPool()
Allocates an Coord3f instance from the pool.


fromPool

public static Coord3f fromPool(float x,
                               float y,
                               float z)
Allocates an Coord3f instance from the pool.


fromPool

public static Coord3f fromPool(Tuple3f tuple)
Allocates an Coord3f instance from the pool.


toPool

public static void toPool(Coord3f o)
Stores the given Coord3f instance in the pool.

Parameters:
o -