MultirotorMixer question

Hi everyone,
I am trying to figure out the MultirotroMix.cpp code.
When some outputs violate range [0,1] then PX 4will try to shift all outputs to minimize violation
I am not quite sure about algorithm it uesd about the if…else if…else if…section:


anyone can give out more explain?if there are some mathematical formulas, that would be better.

I guess there is no complicated math, just sift the outputs by the same scale as sated in the explanation.
> 2) if some outputs violate range [0,1] then try to shift all outputs to minimize violation ->…
For example, if the four outputs are -0.3, 0.1, 0.4, 1.1, it would go into the fourth else if.
Then the boost would be constrained by max_thrust_diff. The scale is the roll_pitch_scale, which means all the outputs are decreased by this scale.
Any correction is appreciated, if anything is wrong.