Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstracted the calculation of signed_error into a SignedError trait to alternative implementations #21

Closed
wants to merge 1 commit into from

Conversation

ripytide
Copy link

Quoting added docs in the PR:

A trait to generalise the notion of signed_error between two
measurements.
For example, between displacement measurements of -10 and 20
there is a signed_error of -30 which is calculated as (-10) - (20). However this subtraction does not work for other
measurements, take for example rotation measurements represented
in radians, imagine the signed_error between a measurement of
2*PI and 4*PI. Using the subtraction method would give us an
signed_error of -2*PI which may not be expected if we consider
2*PI and 4*PI to be equivalent and hence expect a
signed_error of 0.
Hence, this trait allows you to implement your own method of
calculating the signed_error between two measurements.
A implementation of the regular subtraction method which is
commonly most appropriate is provided via [RegularSignedError].

Feel free to ignore the PR, I offer the changes in case others feel they are useful.

@ripytide
Copy link
Author

ripytide commented Feb 4, 2024

Actually, I think you can just make a newtype and implement core::ops::Sub on it with the required SignedError behaviour rather than making a new trait.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant