Creates a new vector with the given x and y coordinates.
X coordinate of the vector
Y coordinate of the vector
Returns the Euclidean length of the vector.
Magnitude of the vector
Returns the squared Euclidean length of the vector.
Useful for distance comparisons that do not need the exact magnitude.
Squared magnitude of the vector
Creates a new vector with the same coordinates.
A new vector with the same x and y coordinates
Checks whether another vector has the same coordinates.
Vector to compare with
True if the vectors are equal, false otherwise
Multiplies the current vector by a scalar in place.
Number to multiply by
The current vector after scaling
Normalizes the current vector to unit length in place.
If the vector magnitude is zero, it remains unchanged.
The current vector after normalization
A 2D vector with x and y coordinates.