Skip to content

Quaternion (Rotation?) pow/exponent function #555

Description

@thatcomputerguy0101

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);
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions