I'm modelling a system of rotation using quaternions. Rotations are snapped to 45 degree intervals on any of our axes, X, Y, or Z. I reason that that this would give the system 208 states, corresponding to the normals of an elongated square gyrobicupola (or pseudo-rhombicuboctahedron, if you prefer), and the 8 45-degree rotations about that normal.

An example of the shape used to model my rotations.

I am currently looking at to how to calculate these 208 quaternions using code.

As I understand it:

  • no rotation would be $[0, 0, 0, 1]$

  • Turning 90 degrees in a direction would be some variation on $[\sqrt{2}, 0, 0, \sqrt{2}]$

  • 45 degrees would be $[ 0.3826834, 0, 0, 0.9238795 ]$

  • But as for the quaternions corresponding to the normal vector, [1,1,1]... what should that that be?

Reasoning that this point is the centroid of a triangle drawn on the face of a sphere, with axes for its vertices, and learning that a centroid lies 2/3 of the way from a vertex to a side, I typed the my guess into a calculator with axes $[1,1,1]$ and an angle of 60 degrees. I got the quaternion $[ 0.2886751, 0.2886751, 0.2886751, 0.8660254 ]$ and the matrix:

$$ \begin{matrix} 0.6666667 & -0.3333333 & 0.6666667 \\ 0.6666667 & 0.6666667 & -0.3333333 \\ -0.3333333 & 0.6666667 & 0.6666667 \end{matrix} $$

Is this correct? Is my reasoning sound? The matrix "feels" right, with that 2/3 and 1/3 balance going on. And if it is, should I have any problem figuring out the rest by rotations using variations on these values?


1 Answer 1


I would look at a different method of getting the centroid.

Imagine you have a spherical triangle with known vertices. Each vertex has an associated quaternion $0+xi+yj+zk$ where $x,y,z$ are the cosines of the angles from the positive axes = the Cartesian coordinates of the point, given in terms of spherical coordinates by the usual conversion formulas with $r=1$.

Draw the planar triangle and note that its centroid is given by the arithmetic average of the coordinates of the vertex coordinates as defined above. The squared sum of these averaged values is less than 1 (Cauchy-Schwarz), meaning the centroid of the planar triangle is of course inside the sphere. But you can multiply by a real positive constant to normalize the magnitude, and that radially projected point is the centroid on the sphere which you want.

For instance, if the triangle vertices are given by $(1,0,0),(0,1,0),(0,0,1)$ or in terms of quaternions $i,j,k$, the average is $(i+j+k)/3$ which has vector magnitude $\sqrt{1/3}<1$. Multiply by $\sqrt3$ to normalize and your result $(i+j+k)/\sqrt3$ properly corresponds to the centroid on the sphere.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .