Top Description Fields Constructors Methods
javax.vecmath

public Class Vector2f

extends Tuple2f
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.lang.Math

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

Field Summary

Modifier and TypeField and Description
pack-priv static final long
Inherited from javax.vecmath.Tuple2f:
xy

Constructor Summary

AccessConstructor and Description
public
Vector2f(float
the x coordinate
x
,
float
the y coordinate
y
)

Constructs and initializes a Vector2f from the specified xy coordinates.

public
Vector2f(float[]
the array of length 2 containing xy in order
v
)

Constructs and initializes a Vector2f from the specified array.

public
Vector2f(Vector2f
the Vector2f containing the initialization x y data
v1
)

Constructs and initializes a Vector2f from the specified Vector2f.

public
Vector2f(Vector2d
the Vector2d containing the initialization x y data
v1
)

Constructs and initializes a Vector2f from the specified Vector2d.

public
Vector2f(Tuple2f
the Tuple2f containing the initialization x y data
t1
)

Constructs and initializes a Vector2f from the specified Tuple2f.

public
Vector2f(Tuple2d
the Tuple2d containing the initialization x y data
t1
)

Constructs and initializes a Vector2f from the specified Tuple2d.

public
Vector2f()

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

Method Summary

Modifier and TypeMethod and Description
public final float

Returns:

the angle in radians in the range [0,PI]
angle
(Vector2f
the other vector
v1
)

Returns the angle in radians between this vector and the vector parameter; the return value is constrained to the range [0,PI].

public final float
dot(Vector2f
the other vector
v1
)

Computes the dot product of the this vector and vector v1.

public final float

Returns:

the length of this vector
length
()

Returns the length of this vector.

public final float

Returns:

the squared length of this vector
lengthSquared
()

Returns the squared length of this vector.

public final void
normalize(Vector2f
the un-normalized vector
v1
)

Sets the value of this vector to the normalization of vector v1.

public final void
normalize()

Normalizes this vector in place.

Inherited from javax.vecmath.Tuple2f:
absoluteabsoluteaddaddclampclampclampMaxclampMaxclampMinclampMincloneepsilonEqualsequalsequalsgetgetXgetYhashCodeinterpolateinterpolatenegatenegatescalescalescaleAddscaleAddsetsetsetsetsetXsetYsubsubtoString

Field Detail

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides javax.vecmath.Tuple2f.serialVersionUID.

Constructor Detail

Vector2fback to summary
public Vector2f(float x, float y)

Constructs and initializes a Vector2f from the specified xy coordinates.

Parameters
x:float

the x coordinate

y:float

the y coordinate

Vector2fback to summary
public Vector2f(float[] v)

Constructs and initializes a Vector2f from the specified array.

Parameters
v:float[]

the array of length 2 containing xy in order

Vector2fback to summary
public Vector2f(Vector2f v1)

Constructs and initializes a Vector2f from the specified Vector2f.

Parameters
v1:Vector2f

the Vector2f containing the initialization x y data

Vector2fback to summary
public Vector2f(Vector2d v1)

Constructs and initializes a Vector2f from the specified Vector2d.

Parameters
v1:Vector2d

the Vector2d containing the initialization x y data

Vector2fback to summary
public Vector2f(Tuple2f t1)

Constructs and initializes a Vector2f from the specified Tuple2f.

Parameters
t1:Tuple2f

the Tuple2f containing the initialization x y data

Vector2fback to summary
public Vector2f(Tuple2d t1)

Constructs and initializes a Vector2f from the specified Tuple2d.

Parameters
t1:Tuple2d

the Tuple2d containing the initialization x y data

Vector2fback to summary
public Vector2f()

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

Method Detail

angleback to summary
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:Vector2f

the other vector

Returns:float

the angle in radians in the range [0,PI]

dotback to summary
public final float dot(Vector2f v1)

Computes the dot product of the this vector and vector v1.

Parameters
v1:Vector2f

the other vector

lengthback to summary
public final float length()

Returns the length of this vector.

Returns:float

the length of this vector

lengthSquaredback to summary
public final float lengthSquared()

Returns the squared length of this vector.

Returns:float

the squared length of this vector

normalizeback to summary
public final void normalize(Vector2f v1)

Sets the value of this vector to the normalization of vector v1.

Parameters
v1:Vector2f

the un-normalized vector

normalizeback to summary
public final void normalize()

Normalizes this vector in place.