elm-geometry icon indicating copy to clipboard operation
elm-geometry copied to clipboard

Test quaternions vs. basis directions for Frame3d implementation

Open ianmackenzie opened this issue 4 years ago • 2 comments

Using quaternions internally would be more compact (fewer allocations!) and would avoid the potential issue of basis directions becoming denormalized/non-orthogonal after repeated rotations. On the other hand, using quaternions could mean that placeIn/relativeTo would be slower (a bit more math to do) and would mean that anything that called Frame3d.xDirection (directly, or indirectly via Frame3d.xAxis etc.) would require allocating a new Direction3d value instead of simply returning the internal Direction3d. To be benchmarked!

ianmackenzie avatar Oct 10 '19 20:10 ianmackenzie

Along the same lines, Frame2d could be internally represented using something like an Angle instead of a pair of basis directions.

ianmackenzie avatar Oct 10 '19 20:10 ianmackenzie

One issue to keep in mind: it's also necessary to be able to represent left-handed frames. Is it sufficient to just have an internal Bool flag? Is there a better way?

ianmackenzie avatar Oct 10 '19 20:10 ianmackenzie