I've attempted to draw a line at a specific angle (180 to -180) and while I got it to work, I had to snipe some of the code from somewhere else, and I'd like to understand it.

My math skills aren't very good. If I were to pit myself against a garden hose in a math battle, I wouldn't bet on myself.

Anyways, here's the formula...

-> Piece 1 "Doing stuff to the angle":

angleConverted = 2.0 * pi * angleIncoming / 360;

'angleIncoming' is the human angle you input, ie. 45.

Now, I'm not really sure what angleConverted is. I'm assuming it's some type of radians to degrees formula because later on in the formula I have to Sin()/Cos() this angle to draw the actual line and they work off radians, but *** is the 2.0?

-> Piece 2 "Setting up the point to draw":

Point degreesPoint = new Point(Convert.ToInt32(picWidth * Math.Sin(angleConverted)), Convert.ToInt32(picHeight * Math.Cos(angleConverted)));

I'd like to keep this language neutral, so I'll explain what's going on here. Basically I'm making a new point, and initializing the X/Y coords.

The X coord is set to the width of the picture box I'm drawing it on * the sine of the angleConverted. The Y coord is the same deal, except I'm using the height of the picture box and Cos'ing the angleConverted.

The Convert.ToInt32() piece is necessary because the Sin/Cos functions return a double not Int, and the point coords are stored as Int, not double. Hence the convert!

So yeah...can someone explain both pieces to me so they make sense? At a later time I would like to reverse engineer the formula, so I can convert the mouse coords into a degree (so the user can drag the line, and it would spit out the degrees in addition to draw the line in real time).