一点A绕着B点旋转X度后的新坐标。
- /// <summary>
- /// 获取A点绕B点旋转P度后的新坐标
- /// </summary>
- /// <param name="Angle">角度</param>
- /// <param name="CirPoint">圆心坐标</param>
- /// <param name="MovePoint">移动点的坐标</param>
- /// <param name="FlagInt">顺时针:1(默认) 逆时针:-1</param>
- /// <returns></returns>
- public static Point GetNewPoint(double Angle, Point CirPoint, Point MovePoint, int FlagInt = 1)
- {
- //将角度转换成弧度
- double Rage2 = Convert.ToDouble(Angle) / 180 * Math.PI;
- //计算新坐标X
- int newx = (int)((MovePoint.X - CirPoint.X) * Math.Cos(Rage2 * FlagInt) - (MovePoint.Y - CirPoint.Y) * Math.Sin(Rage2 * FlagInt));
- //计算新坐标Y
- int newy = (int)((MovePoint.Y - CirPoint.Y) * Math.Cos(Rage2 * FlagInt) + (MovePoint.X - CirPoint.X) * Math.Sin(Rage2 * FlagInt));
- //计算新坐标
- Point newpoint = new Point(CirPoint.X + newx, CirPoint.Y + newy);
- //返回新坐标
- return newpoint;
- }
复制代码
|
|