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

Transcendentals2 #554

Closed
wants to merge 3 commits into from
Closed

Conversation

adamnemecek
Copy link
Contributor

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

Copy link
Member

@sebcrozet sebcrozet left a 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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
N::zero()
N::one()

#[inline]
fn sinhc<N: Real>(v: N) -> N {
if v == N::zero() {
N::zero()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Calculates quaternionic sin
/// Calculates the quaternionic cosinus.

Self::from_parts(self.w.cos() * z.cosh(), self.imag() * w)
}

/// Calculates quaternionic sin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Calculates quaternionic sin
/// Calculates the quaternionic sinus.

Copy link
Collaborator

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.

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.

None yet

3 participants