This is in fact a really handy function, thank you!

The only drawback is, that it can't be used in the free version of lite-C (full version too?) as lite-C wasn't updated since several months. But I guess this could be solved by using your quaternion code?