Top Description Fields Constructors Methods
javax.vecmath

public Class Vector2d

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

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

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
Vector2d(double
the x coordinate
x
,
double
the y coordinate
y
)

Constructs and initializes a Vector2d from the specified xy coordinates.

public
Vector2d(double[]
the array of length 2 containing xy in order
v
)

Constructs and initializes a Vector2d from the specified array.

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

Constructs and initializes a Vector2d from the specified Vector2d.

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

Constructs and initializes a Vector2d from the specified Vector2f.

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

Constructs and initializes a Vector2d from the specified Tuple2d.

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

Constructs and initializes a Vector2d from the specified Tuple2f.

public
Vector2d()

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

Method Summary

Modifier and TypeMethod and Description
public final double

Returns:

the angle in radians in the range [0,PI]
angle
(Vector2d
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 double
dot(Vector2d
the other vector
v1
)

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

public final double

Returns:

the length of this vector
length
()

Returns the length of this vector.

public final double

Returns:

the squared length of this vector
lengthSquared
()

Returns the squared length of this vector.

public final void
normalize(Vector2d
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.Tuple2d:
absoluteabsoluteaddaddclampclampclampMaxclampMaxclampMinclampMincloneepsilonEqualsequalsequalsgetgetXgetYhashCodeinterpolateinterpolatenegatenegatescalescalescaleAddscaleAddsetsetsetsetsetXsetYsubsubtoString

Field Detail

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides javax.vecmath.Tuple2d.serialVersionUID.

Constructor Detail

Vector2dback to summary
public Vector2d(double x, double y)

Constructs and initializes a Vector2d from the specified xy coordinates.

Parameters
x:double

the x coordinate

y:double

the y coordinate

Vector2dback to summary
public Vector2d(double[] v)

Constructs and initializes a Vector2d from the specified array.

Parameters
v:double[]

the array of length 2 containing xy in order

Vector2dback to summary
public Vector2d(Vector2d v1)

Constructs and initializes a Vector2d from the specified Vector2d.

Parameters
v1:Vector2d

the Vector2d containing the initialization x y data

Vector2dback to summary
public Vector2d(Vector2f v1)

Constructs and initializes a Vector2d from the specified Vector2f.

Parameters
v1:Vector2f

the Vector2f containing the initialization x y data

Vector2dback to summary
public Vector2d(Tuple2d t1)

Constructs and initializes a Vector2d from the specified Tuple2d.

Parameters
t1:Tuple2d

the Tuple2d containing the initialization x y data

Vector2dback to summary
public Vector2d(Tuple2f t1)

Constructs and initializes a Vector2d from the specified Tuple2f.

Parameters
t1:Tuple2f

the Tuple2f containing the initialization x y data

Vector2dback to summary
public Vector2d()

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

Method Detail

angleback to summary
public final double angle(Vector2d 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:Vector2d

the other vector

Returns:double

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

dotback to summary
public final double dot(Vector2d v1)

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

Parameters
v1:Vector2d

the other vector

lengthback to summary
public final double length()

Returns the length of this vector.

Returns:double

the length of this vector

lengthSquaredback to summary
public final double lengthSquared()

Returns the squared length of this vector.

Returns:double

the squared length of this vector

normalizeback to summary
public final void normalize(Vector2d v1)

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

Parameters
v1:Vector2d

the un-normalized vector

normalizeback to summary
public final void normalize()

Normalizes this vector in place.