C# 点绕某点旋转某角度

出处找不到了难过

        /// <summary>
        /// 以中心点旋转Angle角度
        /// </summary>
        /// <param name="center">中心点</param>
        /// <param name="p1">待旋转的点</param>
        /// <param name="angle">旋转角度(弧度)</param>
        private void PointRotate(Point center, ref Point p1, double angle)
        {
            double x1 = (p1.X - center.X) * Math.Cos(angle) + (p1.Y - center.Y) * Math.Sin(angle) + center.X;
            double y1 = -(p1.X - center.X) * Math.Sin(angle) + (p1.Y - center.Y) * Math.Cos(angle) + center.Y;
            p1.X = (int)x1;
            p1.Y = (int)y1;
        }


 

你可能感兴趣的:(C#)