public class Vector4 extends Vector3
Constructor and Description |
---|
Vector4()
This default constructor will initialize vector (0, 0, 0, 1);
|
Vector4(double x,
double y,
double z)
This constructor will initialize vector (X, Y, Z, 1) from the specified
X, Y, Z coordinates.
|
Vector4(double x,
double y,
double z,
double w)
This constructor will initialize vector (X, Y, Z, W) from the specified
X, Y, Z, W coordinates.
|
Modifier and Type | Method and Description |
---|---|
Vector4 |
add(double s) |
Vector4 |
add(Vector4 v)
Sets the value of this vector to the sum of itself and v1.
|
Vector4 |
add(Vector4 v1,
Vector4 v2)
Sets the value of this vector to the sum of vectors v1 and v2.
|
void |
addW(double w)
This method will add specified value to W coordinate of the vector.
|
Vector4 |
applyMatrix4(Matrix4 m) |
Vector4 |
ceil() |
Vector4 |
clamp(double minVal,
double maxVal) |
Vector4 |
clamp(Vector4 min,
Vector4 max)
This function assumes min < max, if this assumption isn't true it will not operate correctly
|
Vector4 |
clone() |
Vector4 |
copy(Vector3 v)
Set value of the vector from another vector.
|
Vector4 |
copy(Vector4 v)
Set value of the vector from another vector.
|
Vector4 |
divide(double scalar) |
Vector4 |
divide(Vector4 v) |
Vector4 |
divide(Vector4 v1,
Vector4 v2) |
double |
dot(Vector4 v1)
returns the dot product of this vector and v1
|
boolean |
equals(Vector4 v) |
Vector4 |
floor() |
double |
getComponent(int index) |
double |
getW()
get W coordinate from the vector
|
double |
length()
Returns the length of this vector.
|
double |
lengthManhattan() |
double |
lengthSq()
Returns the squared length of this vector
|
Vector4 |
lerp(Vector4 v1,
double alpha) |
Vector4 |
max(Vector4 v) |
Vector4 |
min(Vector4 v) |
Vector4 |
multiply(double s)
Sets the value of this vector to the scalar multiplication of the scale
factor with this.
|
Vector4 |
multiply(Vector4 v) |
Vector4 |
multiply(Vector4 v1,
Vector4 v2) |
Vector4 |
negate()
Negates the value of this vector in place.
|
Vector4 |
normalize()
Normalizes this vector in place.
|
Vector4 |
round() |
Vector4 |
roundToZero() |
Vector4 |
set(double x,
double y,
double z,
double w)
Sets the value of this vector to the specified xyzw coordinates.
|
Vector4 |
setAxisAngleFromQuaternion(Quaternion q)
|
Vector4 |
setAxisAngleFromRotationMatrix(Matrix4 m)
|
void |
setComponent(int index,
double value) |
Vector4 |
setLength(double l) |
void |
setW(double w)
This method sets W coordinate of the vector.
|
Vector4 |
sub(Vector4 v)
Sets the value of this vector to the difference of itself and v1 (this =
this - v).
|
Vector4 |
sub(Vector4 v1,
Vector4 v2)
Sets the value of this vector to the difference of vectors v1 and v2
(this = v1 - v2).
|
java.lang.String |
toString() |
add, add, addZ, angleTo, apply, apply, apply, applyAxisAngle, applyEuler, applyProjection, clamp, cross, cross, distanceTo, distanceToSquared, divide, divide, dot, equals, fromArray, fromArray, getZ, lerp, max, min, multiply, multiply, project, projectOnPlane, projectOnVector, reflect, set, set, setFromMatrixColumn, setFromMatrixPosition, setFromMatrixScale, setZ, sub, sub, toArray, toArray, transformDirection, unproject
public Vector4()
public Vector4(double x, double y, double z)
x
- the X coordinatey
- the Y coordinatez
- the Z coordinatepublic Vector4(double x, double y, double z, double w)
x
- the X coordinatey
- the Y coordinatez
- the Z coordinatew
- the W coordinatepublic double getW()
public void addW(double w)
w
- the W coordinatepublic void setW(double w)
w
- the W coordinatepublic Vector4 set(double x, double y, double z, double w)
x
- the x coordinatey
- the y coordinatez
- the z coordinatew
- the w coordinatepublic void setComponent(int index, double value)
setComponent
in class Vector3
public double getComponent(int index)
getComponent
in class Vector3
public Vector4 copy(Vector4 v)
v
- the other vectorpublic Vector4 add(Vector4 v1, Vector4 v2)
v1
- the first vectorv2
- the second vectorpublic Vector4 add(Vector4 v)
v
- the other vectorpublic Vector4 sub(Vector4 v1, Vector4 v2)
v1
- the first vectorv2
- the second vectorpublic Vector4 sub(Vector4 v)
v
- the other vectorpublic Vector4 multiply(double s)
public Vector4 setAxisAngleFromQuaternion(Quaternion q)
q
- is assumed to be normalizedpublic Vector4 setAxisAngleFromRotationMatrix(Matrix4 m)
m
- assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)public Vector4 clamp(Vector4 min, Vector4 max)
public Vector4 roundToZero()
roundToZero
in class Vector3
public Vector4 negate()
public double dot(Vector4 v1)
v1
- the other vectorpublic double length()
public double lengthSq()
public double lengthManhattan()
lengthManhattan
in class Vector3
public Vector4 normalize()
public boolean equals(Vector4 v)