We've got a lighting head that can be controlled using heading/pitch coordinates.
Our goal is to make it follow a point on a virtual 2D plane that is being projected on a wall ( photo included ) - so by moving the point in X axis the light's spot should move horizontally on our physical screen surface.
Done some research and first we tried to achieve this using homographic transformation - we converted a point from a flat 2D rectangle - that is our virtual screen - onto distorted quadriteral - created by aiming the light onto each of the four corners of our physical screen surface.
( our reference: http://www.corrmap.com/features/homography_transformation.php )
We've checked if those coordinates are translated properly - points were moving correctly ( photo below ).
At this moment we noticed that light's beam moved between screen points in an arc-style curved line - not a straight line as we assumed would happen.
We googled more and found out that this is not complete solution because heading/pitch are not cartesian axises but spherical ones.
A correct motion of the point from one screen's corner to another should not be straight but curved - something like a fragment of a great circle on a sphere.
PHOTO ( source: Spherical projection )
OFC it differs depending on light's position in a reference to screen's position.
So we captured four points on a sphere using light's heading/pitch rotation and converted them onto cartesian XYZ - that gave us trapezoid in a 3D space whose corner points are located on sphere's surface. And for now - we assume the next steps are:
Convert point from the virtual 2D plane ( our virtual screen ) onto the 3D trapezoid whose vertices lie on surface of the sphere - this would gives us proper lookAt vector, then
Calculate an angle between that vector and a forward vector (0, 0, -1) - this would give us desirable rotation.
The thing is we can't find anywhere a solution for step 1.
Or our understanding of the problem is not right.
Or maybe there is an another, more suitable and straightforward solution to this problem.
PS Should this question be posted here in math.stackexchange or in stackoverflow page instead?