data
Class Vector3

java.lang.Object
  extended by data.Vector3

public class Vector3
extends java.lang.Object

three dimensional float vector

Author:
Fennes

Field Summary
 float x
           
 float y
           
 float z
           
 
Constructor Summary
Vector3()
          x,y and z are set to 0
Vector3(float x, float y, float z)
          vector constructor. sets x, y and z components to the given parameters
 
Method Summary
 Vector3 add(Vector3 other)
          adds this to other vector and stores result in this
 Vector3 clone()
          copies the value of this and returns a clone
 float distance(Vector3 other)
          calculates the distance between the two points specified by this vector and other
 float length()
          returns the length of the vector
 Vector3 mult(float scalar)
          multiplies this with scalar and stores result in this
 Vector3 normalize()
          normalizes this vector
 void set(float x, float y, float z)
          sets x, y and z components to the given parameters
 Vector3 sub(Vector3 other)
           
 Vector3 subThisFrom(Vector3 other)
          subtracts this from other and stores result in this
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

public float x

y

public float y

z

public float z
Constructor Detail

Vector3

public Vector3()
x,y and z are set to 0


Vector3

public Vector3(float x,
               float y,
               float z)
vector constructor. sets x, y and z components to the given parameters

Parameters:
x - x
y - y
z - z
Method Detail

set

public void set(float x,
                float y,
                float z)
sets x, y and z components to the given parameters

Parameters:
x - x
y - y
z - z

distance

public float distance(Vector3 other)
calculates the distance between the two points specified by this vector and other

Parameters:
other - other vector interpreted as point
Returns:
distance

normalize

public Vector3 normalize()
normalizes this vector

Returns:
this

length

public float length()
returns the length of the vector

Returns:
length

sub

public Vector3 sub(Vector3 other)

subThisFrom

public Vector3 subThisFrom(Vector3 other)
subtracts this from other and stores result in this

Parameters:
other - vector from which this is subtracted
Returns:
this

add

public Vector3 add(Vector3 other)
adds this to other vector and stores result in this

Parameters:
other - other vector that is added
Returns:
this

mult

public Vector3 mult(float scalar)
multiplies this with scalar and stores result in this

Parameters:
scalar -
Returns:
the vector = result

clone

public Vector3 clone()
copies the value of this and returns a clone

Overrides:
clone in class java.lang.Object