Distance between quaternions, ignoring one axis of rotation Disclaimer: first time using quaternions.
I needed to determine the distance between a orientation given by quaternion $q_1$ and a target orientation $q_t$.
Both quaternions are normalized. Therefore:
$$d = 2(1-q_1 \cdot q_t)$$
This works very well, but now I need to extend the problem to ignore one axis of rotation (the z-axis in my illustration, pardon my bad drawing skills).

Instead of the distance to a single orientation, drawn as one arrow, I require to know the distance to the entire circle of possibilities.
I figured I need to remove the yaw part of the two quaternions. Is this possible, preferably without converting to euler angles? Thank you in advance!
 A: Although the following solution doesn't answer how to solve this problem using quaternions, it does solve how to find the shortest rotation when ignoring one axis. 
Using two of the three Euler angles (roll/pitch/yaw), this problem can be solved simply. In my case, I used roll and pitch.
My thought process: 


*

*two rotational axes (roll & pitch) can be easily used to generate a point on the unit sphere in spherical coordinates. 

*find the distance between those two points along the sphere

*that distance will be the angle between the two points in radians (the circumference of any circle that intersects the middle of the unit sphere is 2*pi*r)


It turns out, this can all be done with one equation, the Great-circle distance equation. See the linked formula. 
Code:
// d2r is a constant for degrees to radians
// e1 and e2 are vectors with roll/pitch/yaw in degrees    
let theta1 = e1.pitch * d2r
let theta2 = e2.pitch * d2r
let phi1 = e1.roll * d2r
let phi2 = e2.roll * d2r

let rotationDifferenceInRadiansIgnoringYawAxis = acos(sin(phi1)*sin(phi2) + cos(phi1) * cos(phi2) * cos(abs(theta1 - theta2)))

