I'm working on a programming project, in this project I'm receiving an angle as a quaternion value, I partially understand how they work but I don't find any math to get the values I need.
What I would need is the angle between a fictional line/vector going to the the quaternion point from the origin (yes I know what you are thinking, but I couldn't think of a better explanation) and the "earth" a plane that is perpendicular to the gravitational vector, in this case one of your planes of reference.
Also I would need to get the rotation of the line/vector, this time the rotation should be according to the plane perpendicular to itself.
If possible all angles should be described as an angle between -180° and 180° (that's were my troubles are from.
In this picture γ complementary angle of the first questing and R is the secondary angle.
Angles
PS: This is the last formula I tried to use.