md3.util
Class Vec3

java.lang.Object
  |
  +--md3.util.Vec3

public final class Vec3
extends java.lang.Object
implements java.io.Serializable

The Vec3 class represents a 3-tuple of floats: (float, float, float).

Author:
Erwin Vervaet (erwin@cs.kuleuven.ac.be)
See Also:
Serialized Form

Field Summary
 float x
           
 float y
           
 float z
           
 
Constructor Summary
Vec3()
          Default constructor.
Vec3(float[] v)
          Create a Vec3 object with given float array tuple data.
Vec3(float x, float y, float z)
          Create a Vec3 object with given float tuple data.
 
Method Summary
 Vec3 cross(Vec3 vec)
          Computes vector cross product.
 void normalize()
          Makes this Vec3 of normal unit length.
 java.lang.String toString()
           
 float v(int i)
          Return the i-th element of the 3-tuple.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public float x

y

public float y

z

public float z
Constructor Detail

Vec3

public Vec3()

Default constructor.


Vec3

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

Create a Vec3 object with given float tuple data.


Vec3

public Vec3(float[] v)

Create a Vec3 object with given float array tuple data.

Method Detail

v

public float v(int i)

Return the i-th element of the 3-tuple.


cross

public Vec3 cross(Vec3 vec)

Computes vector cross product.

Parameters:
vec - tuple to do the cross product with
Returns:
this * vec

normalize

public void normalize()

Makes this Vec3 of normal unit length.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object