Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tinrab/temelj/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Vector2 API provides immutable operations for working with 2D vectors. All operations return new vector instances rather than modifying existing ones.Types
Vector2
Represents a point or direction in 2D space.The x coordinate
The y coordinate
Constructor functions
of
Creates a new vector with the specified coordinates.The x coordinate
The y coordinate
A new vector with the specified coordinates
zero
Creates a vector at the origin (0, 0).A vector with x and y set to 0
copy
Creates a shallow copy of a vector.The vector to copy
A new vector with the same coordinates
Comparison
equals
Checks if two vectors have the same coordinates.First vector to compare
Second vector to compare
True if both x and y coordinates are equal
Arithmetic operations
plus
Adds two vectors component-wise.First vector
Second vector
A new vector with summed coordinates
add
Adds scalar values to a vector’s coordinates.The base vector
Value to add to x coordinate
Value to add to y coordinate
A new vector with added values
minus
Subtracts one vector from another component-wise.Vector to subtract from
Vector to subtract
A new vector with subtracted coordinates
subtract
Subtracts scalar values from a vector’s coordinates.The base vector
Value to subtract from x coordinate
Value to subtract from y coordinate
A new vector with subtracted values
times
Multiplies two vectors component-wise.First vector
Second vector
A new vector with multiplied coordinates
multiply
Multiplies a vector’s coordinates by scalar values.The base vector
Multiplier for x coordinate
Multiplier for y coordinate
A new vector with multiplied values
scale
Scales a vector by a uniform factor.The vector to scale
The scale factor applied to both coordinates
A new vector scaled by the factor
divided
Divides one vector by another component-wise.Numerator vector
Denominator vector
A new vector with divided coordinates
divide
Divides a vector’s coordinates by scalar values.The vector to divide
Divisor for x coordinate
Divisor for y coordinate
A new vector with divided values
negate
Negates both components of a vector.The vector to negate
A new vector with negated coordinates
Utility operations
snap
Snaps a vector’s coordinates to the nearest grid point.The vector to snap
The grid size
A new vector snapped to the grid
clamp
Clamps a vector’s coordinates between minimum and maximum values.The vector to clamp
Minimum bounds
Maximum bounds
A new vector with clamped coordinates
clampMin
Clamps a vector’s coordinates to minimum values only.The vector to clamp
Minimum bounds
A new vector with coordinates not below minimum
clampMax
Clamps a vector’s coordinates to maximum values only.The vector to clamp
Maximum bounds
A new vector with coordinates not above maximum
displayString
Converts a vector to a readable string representation.The vector to convert
A formatted string representation