tarcieri / micromath

Embedded Rust arithmetic, 2D/3D vector, and statistics library
Apache License 2.0
401 stars 21 forks source link

Add From/Into array and tuple for Vector2d, Vector3d and Quaternion #111

Closed sunsided closed 4 months ago

sunsided commented 4 months ago

This adds From<Vector2d<C>> for [C; 2] and From<Vector3d<C>> for [C; 3] (and their Into, as well as tuple counterparts). The functions to_array() already existed, so this simply expresses it as a trait implementation.

Same for Quaternion to keep the symmetry in behavior, the to_array function also existed here already.