I'm a develepper and I need help with basic trigonometry.
In my application I have a image representing the level of the "artificial horizon" in a plane. Blue is the sky, brown is the ground.
When I move the nose of the plane up, I move the image down:
When I move the nose of the plane down, I move the picture up :
This is called the "pitch"
So far I've been modifying only the x axis of the image:
When I "roll" the plane I rotate the picture either to the left or right:
Now, the problem is that once I rotated the picture and want to modify the "pitch", I dont know which formula to use to find the correct x,y to move the picture towards the sky or ground direction:
In other words, when I rotate the picture with an angle β, what are the x, y value to add to the center of the image to move it on the red line ?
I thought that using simple trigonometry should work:
cos(α) = x /h
sin(α) = y / h
x = h * cos(α)
y = h * sin(α)
then simply add the x and y to the current coordinates of the image. The resulting behaviour in my application is not correct though
Is this a correct formula to use ?