代码实现点绕着另一个点旋转某个角度

// 基本点
Point ptBase = new Point(200,200);
//点逆时针旋转90度
private Point rotate(Point p)
{
	double degree = -Math.PI / 2;

	int x = (int)((p.X - ptBase.X) * Math.Cos(degree) + (p.Y - ptBase.Y) * Math.Sin(degree) + ptBase.X);
	int y = (int)(-(p.X - ptBase.X) * Math.Sin(degree) + (p.Y - ptBase.Y) * Math.Cos(degree) + ptBase.Y);

	return new Point(x, y);
}

你可能感兴趣的:(代码实现点绕着另一个点旋转某个角度)