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:

  1. 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

  2. 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?

  • $\begingroup$ It is not clear from your question, how the light source moves as it is being steered. From your description of the issue, it appears that it does not rotate about a point located at the source itself. $\endgroup$ – S. McGrew Mar 30 '18 at 18:00
  • $\begingroup$ The questions here and here might be of some interest. $\endgroup$ – hypergeometric Mar 31 '18 at 16:29
  • $\begingroup$ @S.McGrew I beg your pardon, it was too obvious for me to write it - the lighting head rotates around a point from which the light's beam is being emitted - it's source point. $\endgroup$ – Winged Apr 1 '18 at 21:03
  • $\begingroup$ It appears that you are looking for a formula that lets you map x,y coordinates on your virtual screen to whatever coordinate system the lighting head steerer uses, but you're not sure exactly what the lighting head steerer's coordinates mean. Is that right? $\endgroup$ – S. McGrew Apr 2 '18 at 4:41
  • $\begingroup$ Here is a much better way to construct the homography. However, you probably don’t need it in the first place. See Andrei’s answer, below. $\endgroup$ – amd Apr 12 '18 at 5:16

I think you are over complicating. Let's call the position of the headlight $(0,0,0)$. Suppose the equation of the plane is known, and you convert the positions of the corners in this plane $V_1, V_2, ...$ to $x, y, z$ in the 3D space. When you move along the line from $V_1$ to $V_2$, the equation is $V_1+t(V_2-V_1)$, where $t$ is going from $0$ to $1$. Now transform this point into polar coordinates, then ignore the radius (make it equal to $1$). You just point the light along the given angles. When you set the radius equal to $1$, you describe the motion on the sphere.

  • $\begingroup$ Don’t you mean spherical coordinates? $\endgroup$ – amd Apr 4 '18 at 1:04
  • $\begingroup$ Sorry. That's exactly what I wanted to say $\endgroup$ – Andrei Apr 4 '18 at 1:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.