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
Transcendentals2 #554
Transcendentals2 #554
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR!
The sinc
and sinhc
functions should be added to the alga crate, as part of the Real
trait (with those implementations given as the default one). For completeness, cosc
and coshc
should be added too.
#[inline] | ||
fn sinc<N: Real>(v: N) -> N { | ||
if v == N::zero() { | ||
N::zero() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N::zero() | |
N::one() |
#[inline] | ||
fn sinhc<N: Real>(v: N) -> N { | ||
if v == N::zero() { | ||
N::zero() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N::zero() | |
N::one() |
@@ -506,6 +527,22 @@ impl<N: Real> Quaternion<N> { | |||
pub fn normalize_mut(&mut self) -> N { | |||
self.coords.normalize_mut() | |||
} | |||
|
|||
/// Calculates quaternionic sin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Calculates quaternionic sin | |
/// Calculates the quaternionic cosinus. |
Self::from_parts(self.w.cos() * z.cosh(), self.imag() * w) | ||
} | ||
|
||
/// Calculates quaternionic sin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Calculates quaternionic sin | |
/// Calculates the quaternionic sinus. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "sine" and "cosine" are the most common spellings of these in English.
Based on #551, adds sin and cos. Implementations are based on the boost implementation
https://www.boost.org/doc/libs/1_63_0/boost/math/quaternion.hpp