Usually the more natural derivation of a quaternion from a rotation
is when you express the rotation as an axis in space and an angle
to rotate through around that axis. If you’ve done your homework
you’ve probably seen such formulas – they are simple and elegant.
On the other hand, the relation between Blender’s Euler angles and
quaternions is relatively ugly, and intuitive (most things related to Euler
angles are) and a formula that converts between the 2 is harder to
Before Blender got quaternion rotations I wrote my own quaternion
class in python for a lark – maybe there is something in the code
that will make it clearer:
P.S. Most CG papers that deal with quaternions usually reference a
paper from the mid-80’s by Ken Shoemake (I believe this was the
first instance of quaternions being used in CG) – if you live in a college
town you might want to see if you can go to the campus library and
photocopy his paper.