public class Vector4f
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static Vector4f |
UNIT_W
A unit vector along the W axis
|
static Vector4f |
UNIT_X
A unit vector along the X axis
|
static Vector4f |
UNIT_Y
A unit vector along the Y axis
|
static Vector4f |
UNIT_Z
A unit vector along the Z axis
|
float |
w
The W value of this vector
|
float |
x
The X value of this vector
|
float |
y
The Y value of this vector
|
float |
z
The Z value of this vector
|
static Vector4f |
ZERO
A vector with values 0, 0, 0
|
Constructor and Description |
---|
Vector4f()
Creates a new Vector4f with default values 0, 0, 0, 0.
|
Vector4f(float x,
float y,
float z,
float w)
Creates a new Vector4f with the provided values.
|
Vector4f(Vector4f copy)
Creates a new Vector4f and copies the X, Y, Z and W values from the
provided vector.
|
Modifier and Type | Method and Description |
---|---|
Vector4f |
add(float addX,
float addY,
float addZ,
float addW)
Creates a new vector with the same values of this vector and adds the
provided values.
|
Vector4f |
add(Vector4f other)
Creates a new vector with the same values of this vector and adds the values
of the provided vector.
|
Vector4f |
addLocal(float addX,
float addY,
float addZ,
float addW)
Adds the provided values to the values of this vector.
|
Vector4f |
addLocal(Vector4f other)
Adds the values of the provided vector to the values of this vector.
|
float |
angleBetween(Vector4f other)
Gets the angle between this vector and another vector.
|
float |
distance(float x,
float y,
float z,
float w)
Gets the distance between this vector and the provided coordinates.
|
float |
distance(Vector4f other)
Gets the distance between this vector and another vector.
|
float |
distanceSquared(float x,
float y,
float z,
float w)
Gets the squared distance between this vector and the provided coordinates.
|
float |
distanceSquared(Vector4f other)
Gets the squared distance between this vector and another Vector4f.
|
Vector4f |
divide(Vector4f other)
Creates a new vector with the same values of this vector and divides the values
of the provided vector.
|
Vector4f |
divideLocal(float scalar) |
Vector4f |
divideLocal(Vector4f other) |
float |
dot(float x,
float y,
float z,
float w)
Gets the dot product of this vector with the provided coordinates.
|
float |
dot(Vector4f other)
Gets the dot product of this vector with the provided vector.
|
boolean |
equals(float x,
float y,
float z,
float w) |
boolean |
equals(java.lang.Object o)
Gets whether or not this vector is equal to another object.
|
float |
getW()
Returns the w value of this vector.
|
float |
getX()
Returns the x value of this vector.
|
float |
getY()
Returns the y value of this vector.
|
float |
getZ()
Returns the z value of this vector.
|
int |
hashCode()
Gets a unique* hash code for this vector, based on its values.
|
Vector4f |
interpolateLocal(Vector4f finalVector,
float mu)
Interpolates this vector to the provided final vector, e.g. if this vector
is (0, 5, 10, 0), and the final vector is (-10, 0, 10, 0), the result (by using
a mu-value of 0.5f) would be (-5, 2.5f, 10, 0)
|
boolean |
isUnitVector()
Checks if this vector is a unit vector.
|
float |
length()
Gets the length of this vector.
|
float |
lengthSquared()
Gets the squared length of this vector.
|
Vector4f |
mult(float scalar)
Creates a new vector with the same values of this vector and multiplies
them with the provided scalar.
|
Vector4f |
mult(float multX,
float multY,
float multZ,
float multW)
Creates a new vector with the same values of this vector and multiplies the
provided values.
|
Vector4f |
mult(Vector4f other)
Creates a new vector with the same values of this vector and multiplies the values
of the provided vector.
|
Vector4f |
multLocal(float scalar)
Multiplies the values of this vector with the provided scalar.
|
Vector4f |
multLocal(float multX,
float multY,
float multZ,
float multW)
Multiplies the values of this vector with the provided values.
|
Vector4f |
multLocal(Vector4f other)
Multiplies the values of this vector with the values of the provided vector.
|
Vector4f |
negate()
Creates a new vector which contains negated values of this vector.
|
Vector4f |
negateLocal()
Negates all values of this vector.
|
Vector4f |
normalizeLocal()
Normalizes this vector (i.e. turn it into a unit vector).
|
Vector4f |
set(float x,
float y,
float z,
float w)
Sets the x, y, z and w values of this vector to the provided values.
|
Vector4f |
set(Vector4f vector)
Sets the x, y, z and w values of this vector to the values of the
provided vector.
|
Vector4f |
setW(float w)
Sets the w value of this vector.
|
Vector4f |
setX(float x)
Sets the x value of this vector.
|
Vector4f |
setY(float y)
Sets the y value of this vector.
|
Vector4f |
setZ(float z)
Sets the z value of this vector.
|
Vector4f |
subtract(float subtractX,
float subtractY,
float subtractZ,
float subtractW)
Creates a new vector with the same values of this vector and subtracts the
provided values.
|
Vector4f |
subtract(Vector4f other)
Creates a new vector with the same values of this vector and subtracts the values
of the provided vector.
|
Vector4f |
subtractLocal(float subtractX,
float subtractY,
float subtractZ,
float subtractW)
Subtracts the provided values from the values of this vector.
|
Vector4f |
subtractLocal(Vector4f other)
Subtracts the values of the provided vector from the values of this vector.
|
java.lang.String |
toString()
Gets a String representation of this vector, for example
(1.0, 4.2, 0.0, -10.0) |
Vector4f |
zero()
Sets all values to 0 (same set
set(0, 0, 0, 0); ). |
public static final Vector4f ZERO
public static final Vector4f UNIT_X
public static final Vector4f UNIT_Y
public static final Vector4f UNIT_Z
public static final Vector4f UNIT_W
public float x
public float y
public float z
public float w
public Vector4f()
public Vector4f(float x, float y, float z, float w)
x
- the x value of the vector.y
- the y value of the vector.z
- the z value of the vector.w
- the w value of the vector.public Vector4f(Vector4f copy)
copy
- the Vector4f to copy.public Vector4f set(Vector4f vector)
vector
- the Vector4f to copy.public Vector4f set(float x, float y, float z, float w)
x
- the x value.y
- the y value.z
- the z value.w
- the w value.public Vector4f setX(float x)
x
- the new x value.public Vector4f setY(float y)
y
- the new y value.public Vector4f setZ(float z)
z
- the new z value.public Vector4f setW(float w)
w
- the new w value.public float getX()
public float getY()
public float getZ()
public float getW()
public float dot(Vector4f other)
other
- the vector to calculate the dot product with.public float dot(float x, float y, float z, float w)
x
- the x coordinate.y
- the y coordinate.z
- the z coordinate.w
- the w coordinate.public float length()
lengthSquared()
public float lengthSquared()
length()
public float distance(Vector4f other)
other
- the other vector.distanceSquared(Vector4f)
public float distance(float x, float y, float z, float w)
x
- the other x coordinate.y
- the other y coordinate.z
- the other z coordinate.w
- the other w coordinate.distanceSquared(float, float, float, float)
public float distanceSquared(Vector4f other)
other
- the other Vector4f.public float distanceSquared(float x, float y, float z, float w)
x
- the other x coordinate.y
- the other y coordinate.z
- the other z coordinate.w
- the other w coordinate.public Vector4f add(Vector4f other)
new Vector4f(this).addLocal(other);
other
- the vector to add.public Vector4f add(float addX, float addY, float addZ, float addW)
new Vector4f(this).addLocal(x, y, z, w);
addX
- the x value to add.addY
- the y value to add.addZ
- the z value to add.addW
- the w value to add.public Vector4f addLocal(Vector4f other)
other
- the vector to add.public Vector4f addLocal(float addX, float addY, float addZ, float addW)
addX
- the x value to add.addY
- the y value to add.addZ
- the z value to add.addW
- the w value to add.public Vector4f subtract(Vector4f other)
new Vector4f(this).subtractLocal(other);
other
- the vector to subtract.public Vector4f subtract(float subtractX, float subtractY, float subtractZ, float subtractW)
new Vector4f(this).subtractLocal(x, y, z, w);
subtractX
- the x value to subtract.subtractY
- the y value to subtract.subtractZ
- the z value to subtract.subtractW
- the w value to subtract.public Vector4f subtractLocal(Vector4f other)
other
- the vector to subtract.public Vector4f subtractLocal(float subtractX, float subtractY, float subtractZ, float subtractW)
subtractX
- the x value to subtract.subtractY
- the y value to subtract.subtractZ
- the z value to subtract.subtractW
- the w value to subtract.public Vector4f mult(float scalar)
scalar
- the value to multiply the vector by.public Vector4f mult(Vector4f other)
new Vector4f(this).multLocal(other);
other
- the vector to multiply.public Vector4f mult(float multX, float multY, float multZ, float multW)
new Vector4f(this).multLocal(x, y, z, w);
multX
- the x value to multiply.multY
- the y value to multiply.multZ
- the z value to multiply.multW
- the w value to multiply.public Vector4f multLocal(float scalar)
scalar
- the value to multiply this vector by.public Vector4f multLocal(Vector4f other)
other
- the vector to multiply.public Vector4f multLocal(float multX, float multY, float multZ, float multW)
multX
- the x value to multiply the x coordinate of this vector by.multY
- the y value to multiply the y coordinate of this vector by.multZ
- the z value to multiply the z coordinate of this vector by.multW
- the w value to multiply the w coordinate of this vector by.public Vector4f divide(Vector4f other)
new Vector4f(this).divideLocal(other);
other
- the vector to divide.public Vector4f divideLocal(float scalar)
public Vector4f negate()
public Vector4f negateLocal()
public Vector4f normalizeLocal()
public float angleBetween(Vector4f other)
other
- the other vector (unit vector).public Vector4f zero()
set(0, 0, 0, 0);
).public boolean isUnitVector()
public Vector4f interpolateLocal(Vector4f finalVector, float mu)
finalVector
- the final vector to interpolate towards.mu
- the mu value between 0.0 and 1.0 (i.e. the percentage change from
this vector to towards the final vector).public boolean equals(java.lang.Object o)
Vector4f
and if it
has exactly the same x, y, z and w values.equals
in class java.lang.Object
o
- the object to compare to equality.Vector4f
and has the
same values as this vector, false if not.public boolean equals(float x, float y, float z, float w)
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
(1.0, 4.2, 0.0, -10.0)
toString
in class java.lang.Object