Hi all. I’d like to introduce Orientations.jl, which provides several parameterizations of orientation and their operations and conversions.
Types:
- AxisAngle
- DirectionCosineMatrix
- EulerRodriguesParameters (“quaternion of rotation”)
- RotationVector
- RollPitchYaw
Operations:
reframe(b_wrt_a, v_a): Ifv_ais a vector expressed in frame A andb_wrt_ais the orientation of frame B wrt frame A (any type of orientation will do), then this returns the same vector expressed in B.compose(c_wrt_b, b_wrt_a): Returns the orientation of C wrt A with the same type as the inputs.difference(c_wrt_a, b_wrt_a): Returns the orientation of C wrt B with the same type as the inputs.distance: Returns the rotation angle of the orientation, the “smallest way around”, in radians.interpolate(o1, o2, f): Interpolates (spherically) from orientation 1 to orientation 2 (both wrt the same reference) usingfin the inclusive range [0, 1].Base.inv(b_wrt_a): Inverts the orientation, returning A wrt B.Base.one(type)/identity_orientation(type): Returns an identity orientation of the given type (no rotation from the reference).Random.rand(rng, type): Returns a random orientation of the given type (any of the available orientation types) drawn uniformly from SO(3).
These types and operations are all as Shuster described them in “A Survey of Attitude Representations”, freely available here – a single, self-consistent reference.
A handful of people have been using this package for a while now. That said, those use cases have been narrow, and more general usage may expose some sharp corners. Please exercise caution and post an issue or PR if you spot anything that’s incorrect.
This package is clearly similar to Rotations.jl, which is a far more mature package. A key difference is that Rotations uses active rotations (vector rotations) saying, “Rotate this vector like so…” whereas this package uses passive rotations (frame rotations) saying, “This frame is rotated from that one like so…” It’s a distinction that matters enough in the work I do that it justifies having its own package. The readme includes notes to convert to the Quaternion type of Rotations.jl.
I hope this package proves useful for folks that think in passive rotations rather than active! Please see the readme for more.