Polyglot:
I can visualize the deflection in your equation. That's simply an angle formed by hypotenuse at the lens to the subject, ie direct distance to a point of a subject. But rotation, I cannot visualize. Care you expand this part a bit?? That's an arctan^2(XY)? Point is taken that the resulting image is a function of an angle. It's just that rotation part, I am having problems with.
Thank you.
The rotation thing is just a bit of trickery to make the transformation spherically symmetric around the lens' axis, while X/Y/Z systems are rectangular.
In the deflection equation:
deflection = atan( sqrt(Xsubject2 + Ysubject2) / Zsubject )
this is just measuring the angle from the lens centreline out to a point in the real world. The stuff in the sqrt is just using pythagoras to measure how far the point is from the lens' axis, then we divide by how far along the lens' axis it is and that is your definition of a tangent. So we take atan, and it tells us the angle from the image centre to the point in space. On a fisheye, that value multiplied by the focal length tells you how far from the image centre the point will appear.
So we know how far a point is from the centre of the image, but in which direction? That's what the rotation equation tells us:
rotation = atan2( Ysubject, Xsubject )
In other words, if you draw a line from image-centre out to the right of the frame, that's zero "rotation". The value increases as you go anticlockwise around the image. Note that here we don't care how far away something is, nor how far it is from the image centre, just what direction something is from the image centre / lens axis. Again with the tangents - draw out a triangle with one corner at the image centre, one corner at the point in question, and the third corner on the X-axis directly above/below the point. Should make it clearer.
Note that atan2 is a
two-argument arctan that works in all 4 quadrants, it is
not arctan
2.
Those two equations convert a point from its rectangular (X/Y/Z) coordinates to spherical coordinates. Consider the camera to be at the centre of the earth and the lens axis points to the North Pole; deflection is latitude (except with 0 at the pole and pi/2 at the equator) and rotation is longitude.
The last step is to convert the spherical coordinates to a plane (x
image, y
image). Since rotation is the angle anticlockwise from the X axis, then x=cos(rotation) and y=sin(rotation) will produce points on a unit circle at the appropriate angle. And we remember that f * deflection is the distance from the image-centre to the image-point, so we multiply the unit-circle by that amount (its proper radius) to get everything in the right place:
ximage = f * deflection * cos (rotation)
yimage = f * deflection * sin (rotation)
Uh, I was told there would be no math....
Hah. Not if I have anything to do with it! How in the hell can you answer a question of geometry without maths? I ain't answerin' your cooking question without talkin' bout food either.