>Hi Dragan,
>
>My name is Simon. I am actually the real guy behind this thread. You see, my friend Gary Wynne kindly posted my original question. However I believed it was time to sign-up for my own account and give Gary a break :)
>
>Thank you for all your thoughts to-date. You input is greatly appreciated!
>
>In your last post you discussed the use of R-Theta or polar coordinates. Would you be able to provide some example pseduo-code for calculating the R-Theta values, so I can better understand your last post?
>
>Here is my shot at it. It is invariably wrong:-
>
>nOffset = 120 -- number pixels from center of obstacle to center of image
>nDegreesPerPixel = pi() / 180 * (nMaxAngle / nMaxPixels)
>nTheta = nOffset * nDegreePerPixel
>r = pi()/180 && < -- here
>x=r*cos(ntheta)
>y=r*sin(ntheta)
I've used 'r' to denote the radius, which is the R in the "R-theta". In polar coordinates you have one point (the pole) and the direction of your initial angle (on Earth, that'd be the prime meridian). Then the positio of any point can be defined by its distance from the pole, and the angle between it and the initial line (on Earth, the PM). Just Google "polar coordinates" -
http://en.wikipedia.org/wiki/Coordinates_(elementary_mathematics) is a good place where most of it is explained.
Now in your code there's only one thing wrong, the way you calculated r. The r should be the distance between the camera and the object. And you're calculating the nTheta for the angle, and then using theta instead - I've fixed that in your code.
Now how would you calculate the distance, that's several messages upstream from this - and I figure Garry can show you how the UT interface (very unorthodox, but we're used to it and it works excellent once you break it in) can be made to show you a lot of things. For one, click the icon below the message which looks like a stack of white sheets, and you should get the whole thread. (IOW, welcome to UT :)