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

Why Quaternion isn't type of Number? #29

Closed
garazha-ilya opened this issue Feb 10, 2025 · 1 comment
Closed

Why Quaternion isn't type of Number? #29

garazha-ilya opened this issue Feb 10, 2025 · 1 comment

Comments

@garazha-ilya
Copy link

  1. It's just a matter of curiosity. But why is a Quaternion not a subtype of Number?
    Like in complex.jl:
struct Complex{T<:Real} <: Number
    re::T
    im::T
end
  1. Should the following function be implemented?
-(q::Quaternion, x::Real) = Quaternion(real(q) - x, imag(q))
@ronisbr
Copy link
Member

ronisbr commented Feb 10, 2025

Hi @garazha-ilya !

It's just a matter of curiosity. But why is a Quaternion not a subtype of Number?
Like in complex.jl:

For reference frame rotations (and attitude control theory), a quaternion is historically represented by a 4 x 1 vector. That's why I decided to not make our implementation an extension of a number.

Should the following function be implemented?

I have to think, but it seems we can define +, -, and * against a quaternion and a number. However, what is the use case? I have never seen something like that useful for reference frame rotations.

@ronisbr ronisbr closed this as not planned Won't fix, can't repro, duplicate, stale Feb 11, 2025
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

2 participants