/// <summary> /// 坐标旋转。逆时针为正。 /// </summary> /// <param name="centerXy"></param> /// <param name="angleRad"></param> /// <returns></returns> public XY RotateRad(TwoDimVector centerXy, double angleRad) { double differX = X - centerXy[0]; double differY = Y - centerXy[1]; double x2 = differX * Math.Cos(angleRad) + differY * Math.Sin(angleRad); double y2 = -differX *Math.Sin(angleRad) + differY * Math.Cos(angleRad); return(new XY(x2 + centerXy[0], y2 + centerXy[1])); }
public virtual XY Rotate(TwoDimVector centerXy, double angleDeg) { double angleRad = angleDeg * CoordConsts.DegToRadMultiplier; return(RotateRad(centerXy, angleRad)); }