java.lang.Object
javax.vecmath.Tuple2d
javax.vecmath.Vector2d
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
TVector2d
A 2 element vector that is represented by single precision
floating point x,y coordinates.
- Version:
- specification 1.1, implementation $Revision: 1.4 $, $Date: 1999/10/05 07:03:50 $
- Author:
- Kenji hiranabe
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionVector2d()
Constructs and initializes a Vector2d to (0,0).Vector2d
(double[] v) Constructs and initializes a Vector2d from the specified array.Vector2d
(double x, double y) Constructs and initializes a Vector2d from the specified xy coordinates.Constructs and initializes a Vector2d from the specified Tuple2d.Constructs and initializes a Vector2d from the specified Tuple2f.Constructs and initializes a Vector2d from the specified Vector2d.Constructs and initializes a Vector2d from the specified Vector2f. -
Method Summary
Modifier and TypeMethodDescriptionfinal double
Returns the angle in radians between this vector and the vector parameter; the return value is constrained to the range [0,PI].clone()
final double
Computes the dot product of the this vector and vector v1.final double
length()
Returns the length of this vector.final double
Returns the squared length of this vector.final void
Normalizes this vector in place.final void
Sets the value of this vector to the normalization of vector v1.
-
Constructor Details
-
Vector2d
public Vector2d(double x, double y) Constructs and initializes a Vector2d from the specified xy coordinates.- Parameters:
x
- the x coordinatey
- the y coordinate
-
Vector2d
public Vector2d(double[] v) Constructs and initializes a Vector2d from the specified array.- Parameters:
v
- the array of length 2 containing xy in order
-
Vector2d
Constructs and initializes a Vector2d from the specified Vector2d.- Parameters:
v1
- the Vector2d containing the initialization x y data
-
Vector2d
Constructs and initializes a Vector2d from the specified Vector2f.- Parameters:
v1
- the Vector2f containing the initialization x y data
-
Vector2d
Constructs and initializes a Vector2d from the specified Tuple2d.- Parameters:
t1
- the Tuple2d containing the initialization x y data
-
Vector2d
Constructs and initializes a Vector2d from the specified Tuple2f.- Parameters:
t1
- the Tuple2f containing the initialization x y data
-
Vector2d
public Vector2d()Constructs and initializes a Vector2d to (0,0).
-
-
Method Details
-
dot
Computes the dot product of the this vector and vector v1.- Parameters:
v1
- the other vector
-
length
public final double length()Returns the length of this vector.- Returns:
- the length of this vector
-
lengthSquared
public final double 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
Sets the value of this vector to the normalization of vector v1.- Parameters:
v1
- the un-normalized vector
-
angle
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
-