bitshifter / glam-rs

A simple and fast linear algebra library for games and graphics
Apache License 2.0
1.5k stars 152 forks source link

impl From<Vec4> for Vec3A violates conversion is lossless contract #521

Closed bitshifter closed 4 months ago

bitshifter commented 4 months ago

According to the From trait documentation

The conversion is lossless: semantically, it should not lose or discard information.

While the w co-ordinate may not be truly lost when SIMD is used the API doesn't expose it via the Vec3A API. The From impl should be replaced by an explicit fn Vec3A::from_vec4(Vec4) -> Self method.