#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
const double pi=acos(-1.0);
struct hh{
double x,y;
};
hh zhuan(hh a,hh b,double p){//点a绕点b转p度
hh fuck;
fuck.x=(a.x-b.x)*cos(p)-(a.y-b.y)*sin(p)+b.x;
fuck.y=(a.x-b.x)*sin(p)+(a.y-b.y)*cos(p)+b.y;
return fuck;
}
int main(){
int t;
scanf("%d",&t);
while(t--){
int n;
scanf("%d",&n);
hh a,b,aa;
a.x=-1;a.y=-2;
aa.x=-1;aa.y=-2;
double k=0;
double p;
for (int i = 0; i < n;i++){
scanf("%lf%lf%lf",&b.x,&b.y,&p);
a=zhuan(a,b,p);
k+=p;
while(k>=2*pi) k-=2*pi;
}
double rx=((a.y-aa.y)*sin(k)+(aa.x+a.x)*cos(k)-(aa.x+a.x))/(2*cos(k)-2);//知道一个点aa和旋转后的点a以及旋转的角度求中心点
double ry=((aa.y+a.y)*cos(k)-(a.x-aa.x)*sin(k)-(aa.y+a.y))/(2*cos(k)-2);
printf("%.10f %.10f %.10f\n",rx,ry,k);
}
return 0;
}
旋转点问题(计算几何模版)
猜你喜欢
转载自blog.csdn.net/lgz0921/article/details/101034052
今日推荐
周排行