# Convert spherical coordinate rotation to aircraft-axes rotation

Spherical coordinate system (I'm using common mathematics convention) Aircraft axes system

To be even more specific, the aircraft-based system that I'm working on has these properties: 1. It's ordered as (roll, -pitch, -yaw), with negative signs representing inverted direction compared to original aircraft system 2. It's always resolved in that order 3. A vector that has roll=0, pitch=0, yaw=0 has θ=0, φ=0

And the spherical coordinate system that I'm implementing takes 1 additional field into account during each conversion, which is roll (as in aircraft's roll). The roll is supposed to be accounted after the vector correctly points at (θ,φ).

If I can choose the resolve-order of the aircraft system then I'm not living in this headache, because if it is possible I'd resolve in (yaw, pitch, roll) order and have the result that I want. But alas, things in programming love to go in the hard way.

So, what is the formulas to have (θ,φ)+(roll) rotation converted to (roll,-pitch,-yaw) rotation?