You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One last refactor for usability. This PR contains two primary changes,
along with a scattering of clean ups and documentation re-writes.
# Support for handling new reference frames
Previously the `ReferenceFrame` enum contained a set list of known
reference frames, and we made sure to maintain an internal list of
transformations for that set list of reference frames. This approach is
obviously pretty inflexible, so I've added a new variant to
`ReferenceFrame` called `Other` to enable defining new reference frames
at run-time. A `String` is used to represent the unknown reference frame
types. This slots in easily with our use of the `strum` macros for
converting the reference frame enums into or from strings, but this does
make the `ReferenceFrame` type no longer triviably copy-able.
I've attempted to reduce the number of clones of the new
`ReferenceFrame`, but they can't be completely avoided without a
significantly different approach of representing new reference frame
types at run-time. I'd be happy to hear suggestions on alternative
approaches if anyone has any.
# Simplify managing reference frame transformations
Previously it was expected that the user of the crate would get the list
of hard-coded transformations with the `get_transformation` function. If
you needed a single transformation that would suffice, but if we didn't
have a direct transformation hard-coded for you then you'd need to
perform multiple transformations. The `TransformationGraph` struct was
available to help to figure out the shortest path of transformations
from one reference frame to another, but the `TransformationGraph`
object didn't actually handle the transformations for you. In short it
was a bit of a pain to use the crate for simple transformations and a
major pain to do more complicated transformations.
To improve the situation I've replaced the old `TransformationGraph`
type with a new `TransformationRepository` type which both maintains the
graph of transformations and also applies multiple transformations for
you in sequence when needed. You're able to easily get one pre-populated
with the hard-coded transformations available, or an empty one, then add
any additional transformations defined at run-time to the graph.
0 commit comments