NewTOAPIA.Drawing.Transform2D.Rotate C# (CSharp) Method

Rotate() public method

public Rotate ( float angle, float x0, float y0 ) : bool
angle float
x0 float
y0 float
return bool
        public bool Rotate(float angle, float x0, float y0)
        {
            float3 unity = new float3(new float2(x0, y0));
            unity.Unit();
            fTransformMatrix = float3x3.Rotate(angle, unity);

            XFORM xm = new XFORM();

            Translate(-x0, -y0);	// make (x0,y0) the origin

            double rad = angle * (Math.PI / 180);

            xm.eM11 = (float)Math.Cos(rad);
            xm.eM12 = (float)Math.Sin(rad);
            xm.eM21 = -xm.eM12;
            xm.eM22 = xm.eM11;
            xm.eDx = 0;
            xm.eDy = 0;

            Combine(xm);			// rotate
            Translate(x0, y0);		// move origin back

            return true;
        }