Core.Geometry.PointE.TransformByRotationAbout C# (CSharp) Method

TransformByRotationAbout() public method

public TransformByRotationAbout ( double rotation, PointE center ) : PointE
rotation double
center PointE
return PointE
        public PointE TransformByRotationAbout(double rotation, PointE center)
        {
            PointE t = this - center;   // translate to origin
            // apply rotation matrix cos x  -sin x
            //                       sin x   cos x which rotates about origin
            double cos = Math.Cos(rotation);
            double sin = Math.Sin(rotation);
            t = new PointE(cos * t.X - sin * t.Y, sin * t.X + cos * t.Y);
            return t + center;            // translate back
        }