已知圆点坐标,圆上一点坐标,求圆上该点在旋转x角度后的坐标?
用极坐标做 x=p.cosA y=p.sinA p等于圆的半径
变换后的坐标就是 x,=p.cos(A+x) y=p.sin(A+x)
//随便定个圆心点坐标
float centerX = 100;
float centerY = 100;
float PI = 3.14159;
//已知点坐标
float pointX = 200;
float pointY = 200;
//旋转角度
float angle = 10*(-1);
//求出半径
float px = pointX - centerX;
float py = pointY - centerY;
float r = sqrt(px*px + py*py);
//求出弧度
float l = (angle * PI)/180;
//得出新坐标
float newX = (pointX - centerX) * cos(l) + (pointY - centerY) * sin(l) + centerX;
float newY = -(pointX - centerX) * sin(l) + (pointY - centerY) * cos(l) + centerY;
cout<<"newX:"<<newX<<"newY:"<<newY<<endl;