Tuple
Class Tuple2f

java.lang.Object
  extended by Tuple.Tuple2f

public class Tuple2f
extends java.lang.Object


Field Summary
 float x
           
 float y
           
 
Constructor Summary
Tuple2f(float x, float y)
          Creates a new instance of Tuple2f
Tuple2f(java.lang.String token)
          Will parse the format used in the toString() method
 
Method Summary
 float distanceSquared(Tuple2f other)
          Finds the squared distance between two Tuples.
 void divideEquals(float a)
          In place divide
 float dot(Tuple2f a)
          Returns the dot product of two Tuples.
 float length()
           
 Tuple2f minus(Tuple2f a)
          Subtract two tuples and return the value in a new Tuple
 Tuple2f plus(Tuple2f a)
          Add two tuples and return the value in a new Tuple
 Tuple2f times(float a)
           
 java.lang.String toString()
           
 
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
Constructor Detail

Tuple2f

public Tuple2f(float x,
               float y)
Creates a new instance of Tuple2f

Parameters:
x -
y -

Tuple2f

public Tuple2f(java.lang.String token)
Will parse the format used in the toString() method

Parameters:
token - string in the format from the toString() method. Specifically, "x:y"
Method Detail

toString

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

distanceSquared

public float distanceSquared(Tuple2f other)
Finds the squared distance between two Tuples. This is useful when comparing distances because it avoids a square root.

Parameters:
other -
Returns:
squared distance

length

public float length()

minus

public Tuple2f minus(Tuple2f a)
Subtract two tuples and return the value in a new Tuple

Parameters:
a -

plus

public Tuple2f plus(Tuple2f a)
Add two tuples and return the value in a new Tuple

Parameters:
a -

divideEquals

public void divideEquals(float a)
In place divide

Parameters:
a - divisor

dot

public float dot(Tuple2f a)
Returns the dot product of two Tuples. Generally, this can b interpreted as the angle between them.

Parameters:
a - compare to this Tuple
Returns:
the dot product

times

public Tuple2f times(float a)