A JavaScript 3D Rotation Calculator

Written by Johnny Ernest
Camera Panning






Euler Rotation Addition/Subtraction [Original += Increment]






Pre-Multiply Quaternion/Matrix [Increment *= Original]






Post-Multiply Quaternion/Matrix [Original *= Increment]






Note in the above that Euler X+/- is the same as Quaternion Pre-Multiply X+/-, and that Euler Z+/- is the same as Quaternion Post-Multiply Z+/-, but Euler Pitch Angle Y+/- is slightly different than Pre/Post-Multiply. Note also that additional math formulas are used to retain the Euler angle in a human readable format when the pitch angle changes between 90 degrees and 270 degrees.
Euler Pitch Angle Addition/Subtraction Emulation by Quaternion Multiplication




Euler to Quaternion Formulas
Note that the order of multiplication matters in the below.
Quaternion Solver
qA
W:
X:
Y:
Z:
qB
W:
X:
Y:
Z:


qA * qB = X; X=
X * qA = qB; X=
qA * X = qB; X=
A =
B =