Euler to Axis-Angle converter

In the past days I got myself acquainted with the astonishingly efficient parametric computer-aided design (CAD) system FreeCAD. It’s open source, so be sure to check it out!

The idea behind how a parametric CAD like FreeCAD works is elegant, yet in practice it poses challenges to developers and novice users: Any single object is described by parameters, constraints and its relationship to other objects. Even if the object is involved in a boolean operation, such as a fusion or a cut-out, be it as the base object or the “tool” object, all original values are retained, and the object itself is held accessible to the user. Let me give you an example to illustrate one case where parametric modelling shows its outstanding features: drillholes, represented by cylinders, in a cube, representing a board of wood. You can at any time access the cylinder objects and change their radius, position, and rotation (and many more parameters).

To sum this up: I am incredibly impressed and overwhelmed by FreeCAD.

There’s just this one thing my mind has a hard time picturing: angle-axis representation of rotations, aka quaternions. Anybody who dealt with any recent 3D engine, be it in game development or in engineering, has come across it. Basically, a rotation is not described by its component rotations around three axis; instead a (normal) vector describes a rotation plane, an angle the rotation in this plane. Probably everybody else in this world has this figured out – I myself have a hard time converting from one to another in my head.

Finding a way to save my brain a bit of pain, and myself some time otherwise used up in trial-and-error attempts of finding the right values, I stumbled upon Martin John Baker’s excellent page on euclidean space, which also offered an easy conversion applet. The culprit? It’s an applet – like in “Java applet”. Hardly any up-to-date browser supports it fully, I had to add security exception rules to my Java VM installation, and click through five-ish warnings each time I wanted to use it.

That’s why I used Martin’s excellent explanation of the formulas for converting between the representations to create a spreadsheet which does exactly the same thing as the applet (short of the nifty airplane turning its nose).

Feel free to use it either here in the iFrame below or directly in Google Docs.


Posted