Package javax.vecmath
Class Vector4f
java.lang.Object
javax.vecmath.Tuple4f
javax.vecmath.Vector4f
- All Implemented Interfaces:
Serializable
,Cloneable
A 4-element vector represented by single-precision floating point x,y,z,w
coordinates.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionVector4f()
Constructs and initializes a Vector4f to (0,0,0,0).Vector4f
(float[] v) Constructs and initializes a Vector4f from the array of length 4.Vector4f
(float x, float y, float z, float w) Constructs and initializes a Vector4f from the specified xyzw coordinates.Constructs and initializes a Vector4f from the specified Tuple3f.Constructs and initializes a Vector4f from the specified Tuple4d.Constructs and initializes a Vector4f from the specified Tuple4f.Constructs and initializes a Vector4f from the specified Vector4d.Constructs and initializes a Vector4f from the specified Vector4f. -
Method Summary
Modifier and TypeMethodDescriptionfinal float
Returns the (4-space) angle in radians between this vector and the vector parameter; the return value is constrained to the range [0,PI].final float
returns the dot product of this vector and v1final float
length()
Returns the length of this vector.final float
Returns the squared length of this vectorfinal void
Normalizes this vector in place.final void
Sets the value of this vector to the normalization of vector v1.final void
Sets the x,y,z components of this vector to the corresponding components of tuple t1.Methods inherited from class javax.vecmath.Tuple4f
absolute, absolute, add, add, clamp, clamp, clampMax, clampMax, clampMin, clampMin, clone, epsilonEquals, equals, equals, get, get, getW, getX, getY, getZ, hashCode, interpolate, interpolate, negate, negate, scale, scale, scaleAdd, scaleAdd, set, set, set, set, setW, setX, setY, setZ, sub, sub, toString
-
Constructor Details
-
Vector4f
public Vector4f(float x, float y, float z, float w) Constructs and initializes a Vector4f from the specified xyzw coordinates.- Parameters:
x
- the x coordinatey
- the y coordinatez
- the z coordinatew
- the w coordinate
-
Vector4f
public Vector4f(float[] v) Constructs and initializes a Vector4f from the array of length 4.- Parameters:
v
- the array of length 4 containing xyzw in order
-
Vector4f
Constructs and initializes a Vector4f from the specified Vector4f.- Parameters:
v1
- the Vector4f containing the initialization x y z w data
-
Vector4f
Constructs and initializes a Vector4f from the specified Vector4d.- Parameters:
v1
- the Vector4d containing the initialization x y z w data
-
Vector4f
Constructs and initializes a Vector4f from the specified Tuple4f.- Parameters:
t1
- the Tuple4f containing the initialization x y z w data
-
Vector4f
Constructs and initializes a Vector4f from the specified Tuple4d.- Parameters:
t1
- the Tuple4d containing the initialization x y z w data
-
Vector4f
Constructs and initializes a Vector4f from the specified Tuple3f. The x,y,z components of this vector are set to the corresponding components of tuple t1. The w component of this vector is set to 0.- Parameters:
t1
- the tuple to be copied- Since:
- vecmath 1.2
-
Vector4f
public Vector4f()Constructs and initializes a Vector4f to (0,0,0,0).
-
-
Method Details
-
set
Sets the x,y,z components of this vector to the corresponding components of tuple t1. The w component of this vector is set to 0.- Parameters:
t1
- the tuple to be copied- Since:
- vecmath 1.2
-
length
public final float length()Returns the length of this vector.- Returns:
- the length of this vector as a float
-
lengthSquared
public final float lengthSquared()Returns the squared length of this vector- Returns:
- the squared length of this vector as a float
-
dot
returns the dot product of this vector and v1- Parameters:
v1
- the other vector- Returns:
- the dot product of this vector and v1
-
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. -
angle
Returns the (4-space) 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]
-