Hi guys,

I'm having a bit of trouble with a bit of trig in C#. I've written code similar to this in actionscript3 (flash), but it is giving me issues in C#. I am not receiving errors, but all the shapes I rotate are somewhat screwed up.

It is worth mentioning that Form1.rad is a constant I am using to convert degrees into radians and back. Math.pi/180

Here is the points array I am using:
static private Point[] drawingPoints = new Point[13]{new Point(14,0),new Point(19,9),new Point(19,18),new Point(25,30),new Point(19,26),new Point(19,18),new Point(19,26),new Point(8,26),new Point(8,18),new Point(0,30),new Point(8,26),new Point(8,9),new Point(14,0)};
Here is the rotation code + the code to draw this.

public void draw (Graphics g)
            Point[] rotatedPoints = new Point[13];

            for (short index = 0; index < rotatedPoints.Length; index++)
                //Finding the location of the points relative to the upper left of the ship.
                Point curPoint = drawingPoints[index];
                Point newPoint = new Point(curPoint.X,curPoint.Y);

                double distToPoint = Form1.distTo(curPoint.X,curPoint.Y,centerPoint.X,centerPoint.Y);//we treat this as the hypotenuse.
                decimal degToPoint = (decimal)Math.Atan(centerPoint.Y - curPoint.Y / centerPoint.X - curPoint.X)/Form1.rad;//Gets the degrees from the center point to the current drawing point without any rotation yet.
                decimal degToNewPoint = degToPoint + rotation;//Add the rotation

                decimal cosToNewPoint = (decimal)Math.Cos((double)(degToNewPoint*Form1.rad));//From the center the cosine.

                //Since cos is adj/hyp to get adj multiply by the hyp.
                newPoint.X = (int)(cosToNewPoint * (decimal)distToPoint);
                decimal sinToNewPoint = (decimal)Math.Sin((double)(degToNewPoint * Form1.rad));//From the center the cosine.


                //Same idea as with the cosine
                newPoint.Y = (int)(sinToNewPoint * (decimal)distToPoint);

                //Adding points to drawing array
                rotatedPoints[index] = newPoint;
            //Adding the screen x y location to the points:

            for (short i = 0; i < rotatedPoints.Length; i++)
                rotatedPoints[i].X += this._x;
                rotatedPoints[i].Y += this._y;
            Pen shipPen = new Pen(shipColor, 2);
            g.DrawLines(shipPen, rotatedPoints);
I know that the drawing code works correctly. If you comment out the rotation parts of the code, it displays my drawing just fine. What is annoying, is that if the rotation is something other than zero, the rotation works, but the shape is still flattened/scewed on one side.

This problem is driving me up the wall, please help .