Class Vector2i
java.lang.Object
dev.prozilla.pine.common.math.vector.Vector<Vector2i>
dev.prozilla.pine.common.math.vector.VectorInt<Vector2i>
dev.prozilla.pine.common.math.vector.Vector2i
2-dimensional vector with integer precision. GLSL equivalent to
ivec2.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(int x, int y) Adds another vector to this vector.clone()Returns a new object that is equal to this object.intCalculates the dot product of this vector with another vector.static Vector2idown()Creates a new vector (0, -1)booleanChecks if the given object is equal to this object.static Vector2igetTemp(int x, int y) Returns a temporary vector with given values.inthashCode()static Vector2ileft()Creates a new vector (-1, 0)intCalculates the squared length of this vector.static Vector2ione()Creates a new vector (1, 1)static Vector2iDeprecated.static Vector2iright()Creates a new vector (1, 0)scale(float scalar) Scales this vector by a scalar.set(int xy) set(int x, int y) voidStores the vector in a given buffer.toString()Converts this vector to a string representation in the format "(x,y)".static Vector2iup()Creates a new vector (0, 1)Methods inherited from class dev.prozilla.pine.common.math.vector.Vector
divide, equals, lerp, negate, normalize, parseToFloats, parseToFloats, parseToIntegers, parseToIntegers, parseToNumbers, subtract
-
Field Details
-
x
public int x -
y
public int y -
temp
Reusable temporary vector, to avoid repeatedly creating new instances in performance-critical contexts.
-
-
Constructor Details
-
Vector2i
public Vector2i()Creates a default 2-dimensional vector with all values set to0. -
Vector2i
public Vector2i(int x, int y) Creates a 2-dimensional vector with given values.
-
-
Method Details
-
set
-
set
-
add
-
add
Description copied from class:VectorAdds another vector to this vector. -
scale
Description copied from class:VectorScales this vector by a scalar. -
lengthSquared
public int lengthSquared()Description copied from class:VectorIntCalculates the squared length of this vector.- Specified by:
lengthSquaredin classVectorInt<Vector2i>
-
dot
Description copied from class:VectorIntCalculates the dot product of this vector with another vector. -
toBuffer
Description copied from class:VectorIntStores the vector in a given buffer. -
hashCode
public int hashCode() -
equals
Description copied from interface:CloneableChecks if the given object is equal to this object. -
clone
Description copied from interface:CloneableReturns a new object that is equal to this object. -
toString
Converts this vector to a string representation in the format "(x,y)". -
parse
Deprecated.Replaced byVector2i.Parseras of 2.0.2- Throws:
InvalidStringException
-
one
Creates a new vector (1, 1) -
up
Creates a new vector (0, 1) -
down
Creates a new vector (0, -1) -
left
Creates a new vector (-1, 0) -
right
Creates a new vector (1, 0) -
getTemp
Returns a temporary vector with given values. Note that this temporary vector is a global instance, so avoid concurrent usage.
-
Vector2i.Parseras of 2.0.2