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

Quaternion (Rotation?) pow/exponent function #555

Open
thatcomputerguy0101 opened this issue Jul 16, 2024 · 0 comments
Open

Quaternion (Rotation?) pow/exponent function #555

thatcomputerguy0101 opened this issue Jul 16, 2024 · 0 comments

Comments

@thatcomputerguy0101
Copy link
Contributor

I'm interested in using a pow/exponent function on the Quaternion type to concisely represent repeated rotations. For quaternions specifically, I found an algorithm for this on the Mathematics StackExchange. However, this concept also applies to other representations of rotations, so it may be more appropriate to add it to the Rotation trait with an implementation for each implementing type. I'd be willing to help implement this functionality for an eventual PR, but wanted feedback on its design before starting.

Example public api:

pub trait Rotation: Sized + Copy + One
//where ...
{
    // Other functions...

    /// Create a new rotation representing `exponent` copies of the original rotation
    fn pow(&self, exponent: <Self::Space as EuclideanSpace>::Scalar) -> Self;

    /// Modifies this rotation to represent `exponent` copies of the original rotation
    fn pow_assign(&mut self, exponent: <Self::Space as EuclideanSpace>::Scalar);
}
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

No branches or pull requests

1 participant