Quaternions for Julia
Author moble
15 Stars
Updated Last
1 Year Ago
Started In
June 2021


Latest DOI Stable docs Documentation Status Test Status Test Coverage PkgEval

Quaternions for Julia


using Pkg


See the documentation for details.


The goal of this project is to build a complete quaternion type in Julia. There are several features that I consider to be fairly basic to a good quaternion package, including

  • Subtypes for rotors and pure-vector quaternions, with corresponding specialized methods
  • Numerous conversions to and from other representations of things quaternions can represent — especially rotations
  • Smooth interpolation, and differentation of the interpolant
  • Intelligent handling of distance measures
  • Construction of random quaternions of the various special types
  • Enabling efficient integration of angular velocity
  • Construction of a minimal rotation
  • Documentation
  • Thorough testing

While there is a wide variety of implementations of quaternions in Julia, none of them tick all these boxes for me, and none seem easy to extend to do so. In particular, the most popular of those has made certain design choices that conflict with my needs.

I have plenty of experience programming quaternions (including this popular python package, and this newer and fancier package), though not much experience with Julia, so this seems like a good first project. In particular, I am interested in understanding how a general geometric algebra would be coded, so I will be experimenting with subtypes and static arrays, even though I can imagine that hard-coding the four components could be better in some ways. Once I'm done experimenting, I may just rewrite that part, though hopefully in a way that will be invisible to users.