UVA10250 - The Other Two Trees
2016-09-22 21:48
387 查看
问题描述
已知A,B两点的坐标,求C,D的坐标,其中AB·CD==-1(两条线段垂直平分)思路
百度学习了一个定理,然后将A,B两点移动到以原点为中点,然后带入公式后AC(测试结果和样例不一样)已知对任意平面向量AB=(x,y),把向量AB绕其起点沿逆时针方向旋转角a得到向量AP=(x*cosa-y*sina,x*sina+y*cosa).
代码
#include <iostream> #include <cstdio> using namespace std; int main() { double x1,y1,x2,y2,x3,y3,x4,y4,x,y; while(cin>>x1>>y1>>x2>>y2) { if(x1==x2&&y1==y2) cout<<"Impossible.\n"; else { x=(x1+x2)/2.0; y=(y1+y2)/2.0; x1-=x; x2-=x; y1-=y; y2-=y; //以原点为起点进行旋转 x3=-y1; y3=x1; x4=-y2; y4=x2; printf("%lf %lf %lf %lf\n",x3+x,y3+y,x4+x,y4+y); } } return 0; }
相关文章推荐
- UVA - 10250 The Other Two Trees
- UVA-10250 The Other Two Trees
- UVa 10250 - The Other Two Trees
- uva10250 The Other Two Trees
- UVa 10250 The Other Two Trees (计算几何)
- UVA - 10250 The Other Two Trees
- UVA 10250 The Other Two Trees
- UVA 10250-The Other Two Trees
- uva 10250 - The Other Two Trees
- UVA 10250 The Other Two Trees
- uva 10250 - The Other Two Trees
- Uva 10250 - The Other Two Trees
- UVA 10250 - The Other Two Trees(几何)
- UVa 10250 The Other Two Trees
- 【Geometry】UVa10250 – The Other Two Trees
- UVa 10250 - The Other Two Trees
- UVA10250-The Other Two Trees
- UVa 10250 The Other Two Trees(数学问题)
- UVa 10250 The Other Two Trees
- Uva 10250 - The Other Two Trees