PDA

View Full Version : Plz help with ANG value

unchained
29th August 2001, 23:41
This value doesn't seem to behave quite the way it's explained in the preset authoring guide...could somebody explain it to me better? (Just playing with if statements, it never seems to yield a value over PI.)

Probably just a few more examples would help (ie. If the pixel is at x,y ang will be z).

My math's rusty as hell, but I'm slowly getting it back thanks to Milkdrop. :) Thanks everybody for your help.

--
unchained

Krash
30th August 2001, 05:41
Alrighty. Crash course in polar geometry, here we come.

Think of your standard x/y plane (called a Cartesian plane). In milkdrop, the x-axis is horizontal, and lies in the middle of the screen. The y-axis is perpendicular to this, and also lies in the middle of the screen. This makes the origin the exact centre of the screen. In Cartesian geometry, all coordinates are expressed as (x,y) values.

Milkdrop is clever, in that it can use cartesian geometry and polar geometry at the same time.

Now, in polar geometry, any coordinate is not expressed as (x,y), instead it is expressed as a function of r and theta. r is the straight line distance from a point to the origin (the radius), and theta is the angle of that straight line with respect to the positive x-axis. Theta is expressed in radians, beacuse you get nicer numbers when you do fancy maths with them. (2pi radians = 360 degrees)

E.g 1
A point with cartesian coordinates (1,0) has polar coordinates r=1, theta=0. The straight line distance between the point and the origin is exactly 1, and the angle between that line and the x axis is 0.

E.g 2
A point (1,sqrt(3)) has polar coordinates r=2, theta=(pi/3). The distance is 2, and the angle is 60 degrees, which is 1/6th of a circle, therefore is 1/6th of 2pi radians, which is pi/3 radians.

E.g 3
A point (1,-sqrt(3)) has polar coordinates r=2, theta=(-pi/3). The distance is 2, and the angle is 60 degrees, which is 1/6th of a circle, therefore is 1/6th of 2pi radians, which is pi/3 radians. However, in this case, the angle is BELOW the x-axis. Radians are measuredanti-clockwise, so when travelling from the x-axis, clockwise to the radial line, a negative angle is traversed.

E.g 4
A point (-1,0) has polar coordinates r=1, theta=pi. The radius is 1, and the angle from the positive x-axis to the radial line is 180 degrees, which is pi radians. But, you may ask, isn't it also 180 degrees anticlockwise? And yes this is true. In this case, you could express theta as -pi, and you would still be correct. When doing mathematics, the answers will be the same. By convention, however, we use pi, and not -pi.

This also allows me to illustrate another point: in milkdrop, the angle is always greater than -pi, and less than or equal to pi. In example 2 above, the angle is pi/3, however this angles can also be expressed as -5pi/3, or 7pi/3, or -11pi/3, etc. It's all the same. The differences only arise when you are calculating loci of polar coordinates, which I won't go into.

I hope that clears it up for you. It's difficult to get a firm grasp of with this little teaching.

EDIT: got my numbers mixed up

- Krash

unchained
2nd September 2001, 19:42
Excellent. I'll need to play around a bit, but that cleared things up for me. Many thanks. :)