Since you asked, you may be interested in reading how to derive the quaternion corresponding to a different orthonormal reference frame. I assume you know that each rotation in 3D can be represented as a rotation or some angle

*theta* around an axis

**axis**. A unit quaternion representing such rotation is defined as

cos(

*theta*/2) + sin(

*theta*/2)*

**axis**.

In this post I will not use the quaternion representation, but the angle-axis representation with the

Rodrigues' rotation formulaR(

*theta*,

**axis**)*

**v** = cos(

*theta*)*v + sin(

*theta*)*cross(

**axis**,

**v**) + (1 - cos(

*theta*))*dot(

**axis**,

**v**)*

**axis.**Let M be the orthogonal matrix of the change of coordinate from the orthonormal reference frame A to the orthonormal reference frame B, R(

*thetaA*,

**axisA**) the rotation in the reference frame A and R(

*thetaB*,

**axisB**) the corresponding rotation in the reference frame B. Then the rotations should satisfy

R(

*thetaB*,

**axisB**)*M*

**v** = M*R(

*thetaA*,

**axisA**)*

**v**Since R(

*thetaA*,

**axisA**)*

**axisA** =

**axisA**, then we should have R(

*thetaB*,

**axisB**)*M*

**axisA** = M*R(

*thetaA*,

**axisA**)*

**axisA** = M*

**axisA**. Then M*

**axisA** should be parallel to

**axisB**. In particular, it will be equal to +axisB or -axisB. Let S represent this sign.

Using the Rodrigues' rotation formula we obtain

cos(

*thetaB*)*M*

**v** + sin(

*thetaB*)*cross(

**axisB**, M*

**v**) + (1 - cos(

*thetaB*))*dot(

**axisB**, M*

**v**)*

**axisB** = M*( cos(

*thetaA*)*

**v** + sin(

*thetaA*)*cross(

**axisA**,

**v**) + (1 - cos(

*thetaA*))*dot(

**axisA**,

**v**)*

**axisA** )

We should now clearly have cos(

*thetaB*) = cos(

*thetaA*) which implies (in [-pi, pi]) abs(

*thetaB*) = abs(

*thetaA*). We also have that M*cross(

**axisA**,

**v**) = det(M)*cross(M*

**axisA**, M*

**v**) = S*det(M)*cross(

**axisB**, M*

**v**). Thus, sin(

*thetaB*) = sin(

*thetaA*)*S*det(M). Finally, we have

dot(

**axisB**, M*

**v**)*

**axisB** = dot(

**axisA**,

**v**)*M*

**axisA** = S*dot(M*

**axisA**, M*

**v**)*

**axisB** = (

**axisB**, M*

**v**)*

**axisB**.

We can thus choose S to be either +1 or -1 and then use the equation sin(

*thetaB*) = sin(

*thetaA*)*S*det(M) to fix

*thetaB* accordingly. For example, if we choose S=-1, then sin(

*thetaA*) = sin(

*thetaB*) in your case which implies

*thetaA* =

*thetaB*. If S=+1 was chosen, then sin(

*thetaA*) = -sin(

*thetaB*) and

*thetaA* = -

*thetaB*.