Seems, i had led out formulas which are very close to truth.

(Pan, Tilt) = F(x, y)

Pan = radToGrad( atan( ((w/2.0) - x) / d) );

Tilt = radToGrad( atan( ((h/2.0) - y) / d) );

d = (sqrt(w*w + h*h) / 2.0) / tan( gradToRad(fov/2.0) );

Where:

w, h - width and height of Java Applet (pixels);

Fov - current field of view angle (degrees);

Pan, Tilt - resulting model coordinates (degrees);

x, y - screen clicked point coordinates (pixels).

function radToGrad( rad )

{

return (rad * 180.0) / 3.14159265358979323846264;

}

function gradToRad( grad )

{

return (grad / 180.0) * 3.14159265358979323846264;

}

Formulas are working well for "Pan", but "Tilt" is distorted nearby of corners. However, if to set Pan=0, then "Tilt" will be rendered precisely true. It points that "perspective transformation" is applied by something way. Still, i have no ideas - how to take this in account.

Somebody have an ideas?

Thanks for response!

(Pan, Tilt) = F(x, y)

Pan = radToGrad( atan( ((w/2.0) - x) / d) );

Tilt = radToGrad( atan( ((h/2.0) - y) / d) );

d = (sqrt(w*w + h*h) / 2.0) / tan( gradToRad(fov/2.0) );

Where:

w, h - width and height of Java Applet (pixels);

Fov - current field of view angle (degrees);

Pan, Tilt - resulting model coordinates (degrees);

x, y - screen clicked point coordinates (pixels).

function radToGrad( rad )

{

return (rad * 180.0) / 3.14159265358979323846264;

}

function gradToRad( grad )

{

return (grad / 180.0) * 3.14159265358979323846264;

}

Formulas are working well for "Pan", but "Tilt" is distorted nearby of corners. However, if to set Pan=0, then "Tilt" will be rendered precisely true. It points that "perspective transformation" is applied by something way. Still, i have no ideas - how to take this in account.

Somebody have an ideas?

Thanks for response!