viva_math/vec2
2-D vector operations.
Companion to viva_math/vector (which is dedicated to PAD/Vec3).
Useful for 2-D dynamics, planar geometry, polar coordinates, etc.
Types
Values
pub fn angle(v: Vec2) -> Float
Angle in radians of v relative to the positive x-axis. Range (-π, π].
pub fn cross(a: Vec2, b: Vec2) -> Float
2-D “cross” returns the z-component of the 3-D cross product.
pub fn from_polar(r: Float, theta: Float) -> Vec2
pub fn length(v: Vec2) -> Float
Length √(x² + y²) — uses hypot to avoid overflow/underflow at extreme scales.
pub fn length_squared(v: Vec2) -> Float