Page 1 of 1

Question About Entity Rotate

Posted: 09 Dec 2008, 11:15
by Anderson
Dear Sir,

I draw a one-entity (rectangle) dxf file, its center point is (1000,1000) and width = 600, height = 800.
When I use the “MergeFileDemo.exe” program, I find If I rotate the entity 90 degree, the entity’s
center point will change to (-1000,1000).
Is there a formula to calculate the entity new center point if I had rotated the entity some degree (ex. 20 or 30)?

Anderson.

Re: Question About Entity Rotate

Posted: 09 Dec 2008, 17:54
by support
Hello,

Rotation occurs respectively to the insert point. Please take a look at the following code which is available in CADConst.cs:

Code: Select all

        public struct DPoint
        public static DPoint Rotate(DPoint p, double angle)
        {
            double s, c;
            DPoint result;
            angle = CADConst.Radian(angle);
            s = Math.Sin(angle);
            c = Math.Cos(angle);
            result.X = c * p.X - s * p.Y;
            result.Y = s * p.X + c * p.Y;
            result.Z = p.Z;
            return result;
        }
Sergey.