beardgame / utilities

General C# (game) utilities library, containing a variety of useful types and algorithms
MIT License
28 stars 14 forks source link

Add typesafe 3D directions and rotations #177

Open tomrijnbeek opened 5 years ago

Jlll1 commented 3 years ago

Is there anything left to be done with that?

paulcscharf commented 3 years ago

We currently only have 3D linear types, none for directions/rotations. We actually had a discussion about that while ago, and the tricky thing is that the same kind of binary representation we use for the Direction2 type likely won't work here, since 3D orientation is a lot more complex. Quaternions may be the way to go instead, but I'm not sure how that would end up in the end.

Ideally we'd like Direction3 (an absolute direction) and Rotation3 (a relative rotation around some axis, can be more than 360 degrees as well), as well as Rotation3Velocity and Rotation3Acceleration types that hide whatever complex implementation details we choose inside and have all the same easy to use operators as the 2D types.

If that's something you want to try and tackle, please be our guest! But it's definitely on the trickier side.