Class Vector3d
java.lang.Object
javax.vecmath.Tuple3d
javax.vecmath.Vector3d
- All Implemented Interfaces:
Serializable, Cloneable
A 3-element vector that is represented by double-precision floating point
x,y,z coordinates. If this value represents a normal, then it should
be normalized.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionVector3d()Constructs and initializes a Vector3d to (0,0,0).Vector3d(double[] v) Constructs and initializes a Vector3d from the array of length 3.Vector3d(double x, double y, double z) Constructs and initializes a Vector3d from the specified xyz coordinates.Constructs and initializes a Vector3d from the specified Tuple3d.Constructs and initializes a Vector3d from the specified Tuple3f.Constructs and initializes a Vector3d from the specified Vector3d.Constructs and initializes a Vector3d from the specified Vector3f. -
Method Summary
Modifier and TypeMethodDescriptionfinal doubleReturns the angle in radians between this vector and the vector parameter; the return value is constrained to the range [0,PI].final voidSets this vector to the vector cross product of vectors v1 and v2.final doubleReturns the dot product of this vector and vector v1.final doublelength()Returns the length of this vector.final doubleReturns the squared length of this vector.final voidNormalizes this vector in place.final voidSets the value of this vector to the normalization of vector v1.Methods inherited from class Tuple3d
absolute, absolute, add, add, clamp, clamp, clamp, clamp, clampMax, clampMax, clampMax, clampMax, clampMin, clampMin, clampMin, clampMin, clone, epsilonEquals, equals, equals, get, get, getX, getY, getZ, hashCode, interpolate, interpolate, interpolate, interpolate, negate, negate, scale, scale, scaleAdd, scaleAdd, scaleAdd, set, set, set, set, setX, setY, setZ, sub, sub, toString
-
Constructor Details
-
Vector3d
public Vector3d(double x, double y, double z) Constructs and initializes a Vector3d from the specified xyz coordinates.- Parameters:
x- the x coordinatey- the y coordinatez- the z coordinate
-
Vector3d
public Vector3d(double[] v) Constructs and initializes a Vector3d from the array of length 3.- Parameters:
v- the array of length 3 containing xyz in order
-
Vector3d
Constructs and initializes a Vector3d from the specified Vector3d.- Parameters:
v1- the Vector3d containing the initialization x y z data
-
Vector3d
Constructs and initializes a Vector3d from the specified Vector3f.- Parameters:
v1- the Vector3f containing the initialization x y z data
-
Vector3d
Constructs and initializes a Vector3d from the specified Tuple3f.- Parameters:
t1- the Tuple3f containing the initialization x y z data
-
Vector3d
Constructs and initializes a Vector3d from the specified Tuple3d.- Parameters:
t1- the Tuple3d containing the initialization x y z data
-
Vector3d
public Vector3d()Constructs and initializes a Vector3d to (0,0,0).
-
-
Method Details
-
cross
-
normalize
Sets the value of this vector to the normalization of vector v1.- Parameters:
v1- the un-normalized vector
-
normalize
public final void normalize()Normalizes this vector in place. -
dot
Returns the dot product of this vector and vector v1.- Parameters:
v1- the other vector- Returns:
- the dot product of this and v1
-
lengthSquared
public final double lengthSquared()Returns the squared length of this vector.- Returns:
- the squared length of this vector
-
length
public final double length()Returns the length of this vector.- Returns:
- the length of this 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]
-