gnu.gleem.linalg
Class Vec3f

java.lang.Object
  |
  +--gnu.gleem.linalg.Vec3f

public class Vec3f
extends java.lang.Object

3-element single-precision vector


Field Summary
static Vec3f NEG_X_AXIS
           
static Vec3f NEG_Y_AXIS
           
static Vec3f NEG_Z_AXIS
           
static Vec3f X_AXIS
           
static Vec3f Y_AXIS
           
static Vec3f Z_AXIS
           
 
Constructor Summary
Vec3f()
           
Vec3f(float x, float y, float z)
           
Vec3f(Vec3f arg)
           
 
Method Summary
 void add(Vec3f b)
          this = this + b
 void add(Vec3f a, Vec3f b)
          this = a + b
 Vec3f addScaled(float s, Vec3f arg)
          Returns this + s * arg; creates new vector
 void addScaled(Vec3f a, float s, Vec3f b)
          this = a + s * b
 Vec3f copy()
           
 Vec3f cross(Vec3f arg)
          Returns this cross arg; creates new vector
 void cross(Vec3f a, Vec3f b)
          this = a cross b.
 float dot(Vec3f arg)
           
 float get(int i)
          Gets the ith component, 0 <= i < 3
 float length()
           
 float lengthSquared()
           
 Vec3f minus(Vec3f arg)
          Returns this - arg; creates new vector
 void normalize()
           
 Vec3f plus(Vec3f arg)
          Returns this + arg; creates new vector
 void scale(float val)
          this = this * val
 void set(float x, float y, float z)
           
 void set(int i, float val)
          Sets the ith component, 0 <= i < 3
 void set(Vec3f arg)
           
 void setX(float x)
           
 void setY(float y)
           
 void setZ(float z)
           
 void sub(Vec3f b)
          this = this - b
 void sub(Vec3f a, Vec3f b)
          this = a - b
 Vec3f times(float val)
          Returns this * val; creates new vector
 Vec3d toDouble()
          Convert to double-precision
 java.lang.String toString()
           
 Vecf toVecf()
           
 float x()
           
 float y()
           
 float z()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

X_AXIS

public static final Vec3f X_AXIS

Y_AXIS

public static final Vec3f Y_AXIS

Z_AXIS

public static final Vec3f Z_AXIS

NEG_X_AXIS

public static final Vec3f NEG_X_AXIS

NEG_Y_AXIS

public static final Vec3f NEG_Y_AXIS

NEG_Z_AXIS

public static final Vec3f NEG_Z_AXIS
Constructor Detail

Vec3f

public Vec3f()

Vec3f

public Vec3f(Vec3f arg)

Vec3f

public Vec3f(float x,
             float y,
             float z)
Method Detail

copy

public Vec3f copy()

toDouble

public Vec3d toDouble()
Convert to double-precision


set

public void set(Vec3f arg)

set

public void set(float x,
                float y,
                float z)

set

public void set(int i,
                float val)
Sets the ith component, 0 <= i < 3


get

public float get(int i)
Gets the ith component, 0 <= i < 3


x

public float x()

y

public float y()

z

public float z()

setX

public void setX(float x)

setY

public void setY(float y)

setZ

public void setZ(float z)

dot

public float dot(Vec3f arg)

length

public float length()

lengthSquared

public float lengthSquared()

normalize

public void normalize()

times

public Vec3f times(float val)
Returns this * val; creates new vector


scale

public void scale(float val)
this = this * val


plus

public Vec3f plus(Vec3f arg)
Returns this + arg; creates new vector


add

public void add(Vec3f b)
this = this + b


add

public void add(Vec3f a,
                Vec3f b)
this = a + b


addScaled

public Vec3f addScaled(float s,
                       Vec3f arg)
Returns this + s * arg; creates new vector


addScaled

public void addScaled(Vec3f a,
                      float s,
                      Vec3f b)
this = a + s * b


minus

public Vec3f minus(Vec3f arg)
Returns this - arg; creates new vector


sub

public void sub(Vec3f b)
this = this - b


sub

public void sub(Vec3f a,
                Vec3f b)
this = a - b


cross

public Vec3f cross(Vec3f arg)
Returns this cross arg; creates new vector


cross

public void cross(Vec3f a,
                  Vec3f b)
this = a cross b. NOTE: "this" must be a different vector than both a and b.


toVecf

public Vecf toVecf()

toString

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