#include<stdio.h>
#include<math.h>
int main()
{
int n,m;
scanf("%d %d",&n,&m);
double strench[100000]={1},rotate[100000]={0};
int ni,mi;
for(ni=0;ni<n;ni++)
{
int type;//操作的类型,1拉伸2旋转
double operate;//具体拉伸和旋转的数值
scanf("%d %lf",&type,&operate);
switch(type)
{
case 1:
strench[ni+1]=strench[ni]*operate;
rotate[ni+1]=rotate[ni];
break;
case 2:
strench[ni+1]=strench[ni];
rotate[ni+1]=rotate[ni]+operate;
break;
default:break;
}
}
for(mi=0;mi<m;mi++)
{
int i,j;
double x,y;
scanf("%d %d %lf %lf",&i,&j,&x,&y);
double k=strench[j]/strench[i-1];//i到j步中一共拉伸了多少
double degree=rotate[j]-rotate[i-1];//i到j步中一共旋转了多少度
double x1=k*x;
double y1=k*y;
double x2=x1*cos(degree)-y1*sin(degree);
double y2=x1*sin(degree)+y1*cos(degree);
printf("%.3lf %.3lf\n",x2,y2);
}
return 0;
}
CCFCSP:202309-2坐标变换(其二)C语言
于 2023-11-21 21:53:28 首次发布