Context
I have some DMX spotlights fixed to a round platform located at 12 meters above the floor. A camera is fixed to the centre (approximately) of this platform. The camera is supposed to film the ground to find and track some targets. This camera is static and give me a 2D plan with an X/Y Cartesian coordinates system. When I found a target, I need to put a spotlight on it.
Illustration
Top view of the scene Top View Image http://img15.hostingpics.net/pics/635699691.png Side view of the scene Side View Image http://img15.hostingpics.net/pics/275272232.png
Problem
To light a target with a spotlight, I need to find the Pan and Tilt angles corresponding of the X/Y position of this target. These spotlights have no specific orientation, but I can find the X/Y projection point of its on the ground with the camera.
Some Data
I found some formulas on the web :
float radius = sqrt( x*x + y*y + z*z );
float inclination = atan2( y, x ) * 180.0 / PI;
float azimuth = acos( z/radius ) * 180.0 / PI;
or
rotx = Math.atan2( y, z )
roty = Math.atan2( x * Math.cos(rotx), z )
rotz = Math.atan2( Math.cos(rotx), Math.sin(rotx) * Math.sin(roty)
but I don't know if it is correct after inconclusive tests..
I don't know if I have the corresponding x, y and z values.
I can find everything you want on my 2D plan: points, vectors, zenith point of the spotlights and I can positioning spotlights where ever you want too. I just can't find the corresponding Pan and Tilt of a particular X/Y point (the target in the camera view) and I don't know how to find its.
I develop in C#.