JuliaGeometry / Quaternions.jl

A Julia implementation of quaternions
https://juliageometry.github.io/Quaternions.jl
MIT License
116 stars 37 forks source link

The documentation doesn't sufficiently clarify when to use Quaternion or quat #127

Closed xiaoxi-david closed 7 months ago

xiaoxi-david commented 1 year ago

I find the documentation confusing because it has some examples that create a quaternion with Quaternion and others with quat, and does not clearly explain what the differences between them are.

After trial and error, I discovered that one difference between Quaternion and quat is that Quaternions([1,2,3]) gives an error, and quat([1,2,3]) does not.

I would like the documentation to explain more clearly when Quaternion and quat are interchangeable and when they are not, and which method is preferable.

sethaxen commented 1 year ago

Thanks for the issue! The general rule is that quat is to Quaternion as complex is to Complex. Complex and Quaternion are both constructors so should return an object of the corresponding type, whereas quat and complex both are documented to also operate on types and arrays.

Any uses of Quaternion(a, b, c, d) in the docs are legacy code that should be updated to use quat, similar to how it's slightly preferred to construct complex numbers with complex over Complex.

If you propose some changes to the docs that make this more clear, I'd be happy to review a PR.