Quaternion memory layout changed to [x, y, z, w]#500
Conversation
The `From` and `Into` impls for `[S; 4]` and `(S, S, S, S)` have been changed accordingly. This is consistent with other libraries like glm, nalgebra, and glam, as well as the glTF spec. Note that the `Quaternion::new` constructor has **not** yet been updated.
|
I think that relying on [S; 4] be any representation is smelly. It's intended to just be a serialization form, only compatible with cgmath itself. If the user needs a particular form, they need to build it, or rely on With this position, it doesn't feel to me that cgmath needs any changes on how slices are converted. Nobody should rely on that implicitly anyway, and if they do - we are going to break their code. |
The slice layout needs to match the struct layout. There's a bunch of unit tests that enforce this and are broken if the slice and tuple conversions aren't updated. I would find it conceptually confusing if the slice/array didn't match the in memory representation to be honest. |
|
That's a good point, I didn't realize it's repr(C). |
The
FromandIntoimpls for[S; 4]and(S, S, S, S)have been changed accordingly. This is consistent with other libraries like glm, nalgebra, and glam, as well as the glTF spec.Note that the
Quaternion::newconstructor has not yet been updated.Related: #499
@kvark I hadn't previously thought much about the From/Into conversions for
[S; 4]and(S, S, S, S). It makes me a little nervous since this change is going to break safe code. We should probably also update theQuaternion::newconstructor but I wanted to see if there was any feedback first.