encapsulated quaternion computation into private functions to avoid wrong angle declarations