ekmett / linear

Low-dimensional linear algebra primitives for Haskell.
http://hackage.haskell.org/package/linear
Other
198 stars 50 forks source link

R1..R4 instances for Quaternion? #131

Closed ghost closed 4 years ago

ghost commented 7 years ago

Been playing around with porting some shadertoy examples and was curious if there's a reason Quaternion doesn't have R instances.

ekmett commented 4 years ago

This is doable. The main "weirdness" is you probably want the scalar part to be w here, so that x y z correspond to the vector part.

ekmett commented 4 years ago

We do have Field instances, so you can use _1, _2, _3 and _4 to access the parts.