Rotate (hdu4998) 几何
来源:互联网 发布:ubuntu命令行解压rar 编辑:程序博客网 时间:2024/06/03 21:54
题目:点击打开链接
题意:一共T组数据,给出n,代表再输入n行,每行x,y代表坐标,P代表这个坐标围绕这个点逆时针旋转P弧度,最后求出一个点和弧度能完成以上效果;
解题思路:其实旋转角度就是总旋转角度对2π取余,然后随意找两个启始点,求出按照题目意思旋转后的终点,这两个终点分别都是到两个启始点距离相等,然后解出方程,我就是以(0.0)(1.1)为启始点解的方程
#include <bits/stdc++.h>using namespace std;const double PI=acos(-1);int main(){ int T,n; scanf("%d",&T); while(T--) { scanf("%d",&n); double r=0; double tx1,ty1,tx2,ty2,x1,x2,y1,y2,a,rx0,ry0; x1=0;y1=0; x2=1;y2=1; for(int i=1;i<=n;i++) { scanf("%lf%lf%lf",&rx0,&ry0,&a); r+=a; if(r>PI*2) r-=PI*2; tx1 = (x1 - rx0) * cos(a) - (y1 - ry0) * sin(a) + rx0; ty1 = (x1 - rx0) * sin(a) + (y1 - ry0) * cos(a) + ry0; tx2 = (x2 - rx0) * cos(a) - (y2 - ry0) * sin(a) + rx0; ty2 = (x2 - rx0) * sin(a) + (y2 - ry0) * cos(a) + ry0; x1=tx1; x2=tx2; y1=ty1; y2=ty2; } double tmp1=(2*x2-2)*(-2*y1)/(2*x1); tmp1=tmp1+(2*y2-2); double tmp2=(x2*x2+y2*y2-2); double tmp3=(2*x2-2)*(x1*x1+y1*y1)/(2*x1); double y=(tmp2-tmp3)/tmp1; double tmp4=x1*x1+y1*y1-2*y*y1; double x=tmp4/(2*x1); printf("%.6lf %.6lf %.6lf\n",x,y,r); } return 0;}
阅读全文
0 0
- Rotate (hdu4998) 几何
- hdu4998 Rotate(计算几何+模拟)
- hdu4998(几何----平面 旋转)
- HDU4998 Rotate(旋转,线段相交模板)
- hdu4998
- HDU4998 Rotate (2014 ACM/ICPC Asia Regional Anshan Online)
- hdu 4998 Rotate(计算几何)
- hdu 4998 Rotate(几何)
- HDU 4998 Rotate --几何
- HDU 4998 Rotate(计算几何 绕点旋转)
- HDU 4998 Rotate (二维图形几何变换)
- HDU 4998 Rotate (几何变换——旋转)
- HDU 4998 Rotate(计算几何 绕点旋转)
- 【计算几何】 HDOJ 4998 Rotate
- HDU 4998 Rotate 计算几何
- HDU 4998 Rotate(计算几何)2014年鞍山赛区网络赛
- HDU 4998 Rotate 简单几何旋转问题
- hdu4998 旋转坐标系
- 差分约束初步
- SGISTL源码探究-内存池
- CSS的一些基础(有待改进)
- Codeforces 854C Planning【贪心+并查集】
- ubuntu 解决unable to resolve host的问题
- Rotate (hdu4998) 几何
- java集合遍历过程中报ConcurrentModificationException异常
- C/C++字符串
- poj 1185 炮兵阵地(状态压缩dp)
- 2754: [SCOI2012]喵星球上的点名
- Tomcat使用指南
- [Java面试六]SpringMVC总结以及在面试中的一些问题.
- easyui combobox 清除选中项目 和 清空option选项
- opencv接口函数