Create a new Vector with x and y components
X component (default: 0)
Y component (default: 0)
Multiply this vector by a scalar
Scalar value to multiply by
New vector representing the scaled vector
Divide this vector by a scalar
Scalar value to divide by
New vector representing the divided vector
Calculate the magnitude (length) of this vector
The magnitude of the vector
Normalize this vector to unit length
New vector with magnitude 1 in the same direction
StaticdistanceStaticzeroStaticunitStaticunitStaticfromCreate a vector from polar coordinates
Length of the vector
Angle in radians
New vector from polar coordinates
Calculate the angle of this vector in radians
Angle in radians (from -π to π)
Calculate the dot product with another vector
Other vector
Dot product result
Calculate the cross product magnitude with another vector (2D cross product)
Other vector
Cross product magnitude (scalar in 2D)
Check if this vector equals another vector (within tolerance)
Other vector
Tolerance for comparison (default: 1e-10)
True if vectors are equal within tolerance
Convert vector to string representation
String representation of the vector
Convert vector to array [x, y]
Array representation of the vector
Convert vector to object {x, y}
Object representation of the vector
Simple Vector class for physics calculations with full TypeScript support