Class Vector4f
- java.lang.Object
-
- net.lax1dude.eaglercraft.v1_8.vector.Vector
-
- net.lax1dude.eaglercraft.v1_8.vector.Vector4f
-
- All Implemented Interfaces:
java.io.Serializable,ReadableVector,ReadableVector2f,ReadableVector3f,ReadableVector4f,WritableVector2f,WritableVector3f,WritableVector4f
public class Vector4f extends Vector implements java.io.Serializable, ReadableVector4f, WritableVector4f
Holds a 4-tuple vector.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Vector4f()Constructor for Vector4f.Vector4f(float x, float y, float z, float w)ConstructorVector4f(ReadableVector4f src)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Vector4fadd(Vector4f left, Vector4f right, Vector4f dest)Add a vector to another vector and place the result in a destination vector.static floatangle(Vector4f a, Vector4f b)Calculate the angle between two vectors, in radiansstatic floatdot(Vector4f left, Vector4f right)The dot product of two vectors is calculated as v1.x * v2.x + v1.y * v2.y + v1.z * v2.z + v1.w * v2.wbooleanequals(java.lang.Object obj)floatgetW()floatgetX()floatgetY()floatgetZ()floatlengthSquared()Vectorload(FloatBuffer buf)Load this vector from a FloatBufferVectornegate()Negate a vectorVector4fnegate(Vector4f dest)Negate a vector and place the result in a destination vector.Vector4fnormalise(Vector4f dest)Normalise this vector and place the result in another vector.Vectorscale(float scale)Scale this vectorvoidset(float x, float y)Set the X,Y valuesvoidset(float x, float y, float z)Set the X,Y,Z valuesvoidset(float x, float y, float z, float w)Set the X,Y,Z,W valuesVector4fset(ReadableVector4f src)Load from another Vector4fvoidsetW(float w)Set WvoidsetX(float x)Set XvoidsetY(float y)Set YvoidsetZ(float z)Set ZVectorstore(FloatBuffer buf)Store this vector in a FloatBufferstatic Vector4fsub(Vector4f left, Vector4f right, Vector4f dest)Subtract a vector from another vector and place the result in a destination vector.java.lang.StringtoString()Vector4ftranslate(float x, float y, float z, float w)Translate a vector-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.lax1dude.eaglercraft.v1_8.vector.ReadableVector
length
-
-
-
-
Constructor Detail
-
Vector4f
public Vector4f()
Constructor for Vector4f.
-
Vector4f
public Vector4f(ReadableVector4f src)
Constructor
-
Vector4f
public Vector4f(float x, float y, float z, float w)Constructor
-
-
Method Detail
-
set
public void set(float x, float y)Description copied from interface:WritableVector2fSet the X,Y values- Specified by:
setin interfaceWritableVector2f
-
set
public void set(float x, float y, float z)Description copied from interface:WritableVector3fSet the X,Y,Z values- Specified by:
setin interfaceWritableVector3f
-
set
public void set(float x, float y, float z, float w)Description copied from interface:WritableVector4fSet the X,Y,Z,W values- Specified by:
setin interfaceWritableVector4f
-
set
public Vector4f set(ReadableVector4f src)
Load from another Vector4f- Parameters:
src- The source vector- Returns:
- this
-
lengthSquared
public float lengthSquared()
- Specified by:
lengthSquaredin interfaceReadableVector- Specified by:
lengthSquaredin classVector- Returns:
- the length squared of the vector
-
translate
public Vector4f translate(float x, float y, float z, float w)
Translate a vector- Parameters:
x- The translation in xy- the translation in y- Returns:
- this
-
add
public static Vector4f add(Vector4f left, Vector4f right, Vector4f dest)
Add a vector to another vector and place the result in a destination vector.- Parameters:
left- The LHS vectorright- The RHS vectordest- The destination vector, or null if a new vector is to be created- Returns:
- the sum of left and right in dest
-
sub
public static Vector4f sub(Vector4f left, Vector4f right, Vector4f dest)
Subtract a vector from another vector and place the result in a destination vector.- Parameters:
left- The LHS vectorright- The RHS vectordest- The destination vector, or null if a new vector is to be created- Returns:
- left minus right in dest
-
negate
public Vector4f negate(Vector4f dest)
Negate a vector and place the result in a destination vector.- Parameters:
dest- The destination vector or null if a new vector is to be created- Returns:
- the negated vector
-
normalise
public Vector4f normalise(Vector4f dest)
Normalise this vector and place the result in another vector.- Parameters:
dest- The destination vector, or null if a new vector is to be created- Returns:
- the normalised vector
-
dot
public static float dot(Vector4f left, Vector4f right)
The dot product of two vectors is calculated as v1.x * v2.x + v1.y * v2.y + v1.z * v2.z + v1.w * v2.w- Parameters:
left- The LHS vectorright- The RHS vector- Returns:
- left dot right
-
angle
public static float angle(Vector4f a, Vector4f b)
Calculate the angle between two vectors, in radians- Parameters:
a- A vectorb- The other vector- Returns:
- the angle between the two vectors, in radians
-
load
public Vector load(FloatBuffer buf)
Description copied from class:VectorLoad this vector from a FloatBuffer
-
store
public Vector store(FloatBuffer buf)
Description copied from class:VectorStore this vector in a FloatBuffer- Specified by:
storein interfaceReadableVector- Specified by:
storein classVector- Parameters:
buf- The buffer to store it in, at the current position- Returns:
- this
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getX
public final float getX()
- Specified by:
getXin interfaceReadableVector2f- Returns:
- x
-
getY
public final float getY()
- Specified by:
getYin interfaceReadableVector2f- Returns:
- y
-
setX
public final void setX(float x)
Set X- Specified by:
setXin interfaceWritableVector2f- Parameters:
x-
-
setY
public final void setY(float y)
Set Y- Specified by:
setYin interfaceWritableVector2f- Parameters:
y-
-
setZ
public void setZ(float z)
Set Z- Specified by:
setZin interfaceWritableVector3f- Parameters:
z-
-
getZ
public float getZ()
- Specified by:
getZin interfaceReadableVector3f- Returns:
- z
-
setW
public void setW(float w)
Set W- Specified by:
setWin interfaceWritableVector4f- Parameters:
w-
-
getW
public float getW()
- Specified by:
getWin interfaceReadableVector4f- Returns:
- w
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-