Question About Entity Rotate

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
Anderson
Posts: 13
Joined: 04 Dec 2008, 12:55

Question About Entity Rotate

Post by Anderson » 09 Dec 2008, 11:15

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.

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: Question About Entity Rotate

Post by support » 09 Dec 2008, 17:54

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.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply