javax.vecmath
Class Vector2f

java.lang.Object
  extended by javax.vecmath.Tuple2f
      extended by javax.vecmath.Vector2f
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Vector2f
extends Tuple2f
implements java.io.Serializable

A 2 element vector that is represented by single precision floating point x,y coordinates.

Author:
Kenji hiranabe
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.vecmath.Tuple2f
x, y
 
Constructor Summary
Vector2f()
          Constructs and initializes a Vector2f to (0,0).
Vector2f(float[] v)
          Constructs and initializes a Vector2f from the specified array.
Vector2f(float x, float y)
          Constructs and initializes a Vector2f from the specified xy coordinates.
Vector2f(Tuple2d t1)
          Constructs and initializes a Vector2f from the specified Tuple2d.
Vector2f(Tuple2f t1)
          Constructs and initializes a Vector2f from the specified Tuple2f.
Vector2f(Vector2d v1)
          Constructs and initializes a Vector2f from the specified Vector2d.
Vector2f(Vector2f v1)
          Constructs and initializes a Vector2f from the specified Vector2f.
 
Method Summary
 float angle(Vector2f v1)
          Returns the angle in radians between this vector and the vector parameter; the return value is constrained to the range [0,PI].
 java.lang.Object clone()
           
 float dot(Vector2f v1)
          Computes the dot product of the this vector and vector v1.
 float length()
          Returns the length of this vector.
 float lengthSquared()
          Returns the squared length of this vector.
 void normalize()
          Normalizes this vector in place.
 void normalize(Vector2f v1)
          Sets the value of this vector to the normalization of vector v1.
 
Methods inherited from class javax.vecmath.Tuple2f
absolute, absolute, add, add, clamp, clamp, clampMax, clampMax, clampMin, clampMin, epsilonEquals, equals, equals, get, hashCode, interpolate, interpolate, negate, negate, scale, scale, scaleAdd, scaleAdd, set, set, set, set, sub, sub, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Vector2f

public Vector2f()
Constructs and initializes a Vector2f to (0,0).


Vector2f

public Vector2f(float[] v)
Constructs and initializes a Vector2f from the specified array.

Parameters:
v - the array of length 2 containing xy in order

Vector2f

public Vector2f(float x,
                float y)
Constructs and initializes a Vector2f from the specified xy coordinates.

Parameters:
x - the x coordinate
y - the y coordinate

Vector2f

public Vector2f(Tuple2d t1)
Constructs and initializes a Vector2f from the specified Tuple2d.

Parameters:
t1 - the Tuple2d containing the initialization x y data

Vector2f

public Vector2f(Tuple2f t1)
Constructs and initializes a Vector2f from the specified Tuple2f.

Parameters:
t1 - the Tuple2f containing the initialization x y data

Vector2f

public Vector2f(Vector2d v1)
Constructs and initializes a Vector2f from the specified Vector2d.

Parameters:
v1 - the Vector2f containing the initialization x y data

Vector2f

public Vector2f(Vector2f v1)
Constructs and initializes a Vector2f from the specified Vector2f.

Parameters:
v1 - the Vector2f containing the initialization x y data
Method Detail

angle

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

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

clone

public java.lang.Object clone()
Specified by:
clone in class Tuple2f

dot

public final float dot(Vector2f v1)
Computes the dot product of the this vector and vector v1.

Parameters:
v1 - the other vector

length

public final float length()
Returns the length of this vector.

Returns:
the length of this vector

lengthSquared

public final float lengthSquared()
Returns the squared length of this vector.

Returns:
the squared length of this vector

normalize

public final void normalize()
Normalizes this vector in place.


normalize

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

Parameters:
v1 - the un-normalized vector