# Rotation plane on the sphere (quarternion)

I asked similar question on stackoverflow but still no answers.https://stackoverflow.com/questions/25185329/image-rotation-with-the-gyro-data-math I assume it is more math than programming problem.

I have an abstract world view sphere. And I have a camera view 2d coordinate plane P(X,Y) which is a view projection from the center of the sphere C to its bounds . Angular dimensions of the view projection are known (vertical and horizontal field of view - FoV_v, FoV_h). I have a point on that plane - PoI (point of interest) with known 2d coordinates on the plane pX, pY. Let's name its sphere projected counterpart PoI_s.

Now I rotate my 2d plane around the center of the sphere. I have the rotation matrix M or the quaternion Q of this rotation (provided by phone gyro data).

The point PoI_n is the point on the rotated plane Pr where it is crossed by the line from the C to the PoI_s.

The question is how can I found new PoI_n coordinates pXn, pYn in the new plane 2d coordinate system (X,Y)n?