Class Vector3f
java.lang.Object
dev.prozilla.pine.common.math.vector.Vector<Vector3f>
dev.prozilla.pine.common.math.vector.VectorFloat<Vector3f>
dev.prozilla.pine.common.math.vector.Vector3f
3-dimensional vector with floating point precision. GLSL equivalent to
vec3
.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd
(float x, float y, float z) Adds another vector to this vector.clone()
Returns a new object that is equal to this object.float
Calculates the dot product of this vector with another vector.boolean
Checks if the given object is equal to this object.static Vector3f
getTemp
(float x, float y, float z) Returns a temporary vector with given values.float
Calculates the squared length of this vector.static Vector3f
scale
(float scalar) Scales this vector by a scalar.void
toBuffer
(FloatBuffer buffer) Stores the vector in a given buffer.toString()
Converts this vector to a string representation in the format "(x,y,z)".Methods inherited from class dev.prozilla.pine.common.math.vector.VectorFloat
length
Methods inherited from class dev.prozilla.pine.common.math.vector.Vector
divide, equals, hashCode, lerp, negate, normalize, parseToFloats, parseToFloats, parseToIntegers, parseToIntegers, parseToNumbers, subtract
-
Field Details
-
x
public float x -
y
public float y -
z
public float z -
temp
Reusable temporary vector, to avoid repeatedly creating new instances in performance-critical contexts.
-
-
Constructor Details
-
Vector3f
public Vector3f()Creates a default 3-dimensional vector with all values set to0f
. -
Vector3f
public Vector3f(float x, float y, float z) Creates a 3-dimensional vector with given values.
-
-
Method Details
-
add
-
add
Description copied from class:Vector
Adds another vector to this vector. -
scale
Description copied from class:Vector
Scales this vector by a scalar. -
lengthSquared
public float lengthSquared()Description copied from class:VectorFloat
Calculates the squared length of this vector.- Specified by:
lengthSquared
in classVectorFloat<Vector3f>
-
dot
Description copied from class:VectorFloat
Calculates the dot product of this vector with another vector.- Specified by:
dot
in classVectorFloat<Vector3f>
- Returns:
- Dot product of this vector multiplied by another vector
-
toBuffer
Description copied from class:VectorFloat
Stores the vector in a given buffer.- Specified by:
toBuffer
in classVectorFloat<Vector3f>
- Parameters:
buffer
- The buffer to store the vector data in
-
equals
Description copied from interface:Cloneable
Checks if the given object is equal to this object. -
clone
Description copied from interface:Cloneable
Returns a new object that is equal to this object. -
toString
Converts this vector to a string representation in the format "(x,y,z)". -
parse
- Throws:
InvalidStringException
-
getTemp
Returns a temporary vector with given values. Note that this temporary vector is a global instance, so avoid concurrent usage.
-