额,弧度什么的在哪点转最后都是一样的,然后你把原点当始点,然后模拟算出末点,套用公式,over。
#include <cstdio> #include <cstring> #include <string> #include <algorithm> #include <iostream> #include <vector> #include <queue> #include <stack> #include <cmath> using namespace std; #define PI acos(-1) main() { double stx, sty, endx, endy, x, y, p, endp, xx, yy; int t, n, i, j, k; cin>>t; while(t--){ cin>>n; stx=sty=xx=yy=endp=0; while(n--){ scanf("%lf %lf %lf",&x,&y,&p); endp+=p; if(endp>=2*PI) endp-=2*PI; endx=(xx-x)*cos(p)-(yy-y)*sin(p)+x; endy=(xx-x)*sin(p)+(yy-y)*cos(p)+y; xx=endx;yy=endy; } x=((endx-stx*cos(endp)+sty*sin(endp))*(1-cos(endp))-(endy-stx*sin(endp)-sty*cos(endp))*sin(endp))/(2-2*cos(endp)); y=((endx-stx*cos(endp)+sty*sin(endp))*(1-cos(endp))-(1-cos(endp))*(1-cos(endp))*x)/((1-cos(endp))*sin(endp)); printf("%.10lf %.10lf %.10lf\n",x,y,endp); } }