UVA 11178 - Morley's Theorem 简单的计算几何
来源:互联网 发布:python3网络数据采集 编辑:程序博客网 时间:2024/05/28 16:28
简单的计算几何题目 求出一个d点 其余的点具有相同的解法
#include<cstdio>#include<cmath>#include<algorithm>#define eps 1e-10using namespace std;struct Point{ double x,y; Point (double x = 0,double y = 0):x(x),y(y){}};typedef Point Vector;Vector operator +(Vector A,Vector B){ return Vector(A.x+B.x,A.y+B.y);}Vector operator -(Vector A,Vector B){ return Vector(A.x-B.x,A.y-B.y);}Vector operator *(Vector A,double p){ return Vector(A.x*p,A.y*p);}double Dot(Vector A, Vector B)//点积{ return A.x*B.x+A.y*B.y;}double Length(Vector A){ return sqrt(Dot(A,A));}double Cross(Vector A, Vector B){ return A.x*B.y -A.y*B.x;}double Angle(Vector A, Vector B){ return acos(Dot(A, B) / Length(A) / Length(B));}Vector Rotate(Vector A, double rad){ return Vector(A.x*cos(rad) - A.y*sin(rad),A.x*sin(rad) + A.y*cos(rad));}Point GetLineIntersection(Point P,Vector v, Point Q, Vector w){ Vector u = P -Q; double t = Cross(w,u) / Cross(v,w); return P + v*t;}int main(){ #ifdef LOCAL freopen("in.txt","r",stdin); #endif // LOCAL int N; scanf("%d",&N); while(N--) { Point a,b,c,d,e,f; scanf("%lf%lf%lf%lf%lf%lf",&a.x,&a.y,&b.x,&b.y,&c.x,&c.y); double ang_a,ang_b,ang_c; ang_a = Angle(b-a,c-a); ang_b = Angle(a-b,c-b); ang_c = Angle(a-c,b-c); d = GetLineIntersection(c,Rotate(a-c,2.0*ang_c/3.0),b,Rotate(c-b,1.0*ang_b/3.0)); e = GetLineIntersection(c,Rotate(a-c,1.0*ang_c/3.0),a,Rotate(b-a,2.0*ang_a/3.0)); f = GetLineIntersection(b,Rotate(c-b,2.0*ang_b/3.0),a,Rotate(b-a,1.0*ang_a/3.0)); printf("%.6lf %.6lf %.6lf %.6lf %.6lf %.6lf\n",d.x,d.y,e.x,e.y,f.x,f.y); } return 0;}
- UVA 11178 - Morley's Theorem 简单的计算几何
- UVA 11178 Morley's Theorem 计算几何
- UVA 11178 - Morley's Theorem(计算几何)
- UVA 11178 Morley's Theorem 计算几何
- UVA 11178 Morley’s Theorem(计算几何直线的交点)
- uva 011178 Morley's Theorem 计算几何
- UVA 11178 Morley's Theorem(计算几何入门)
- UVA 11178 Morley’s Theorem(二维计算几何基础)
- UVA - 11178 - Morley's Theorem (计算几何~~)
- UVA-11178 - Morley's Theorem(计算几何)
- UVa 11178 Morley's Theorem(几何)
- UVA - 11178 Morley's Theorem //几何初探
- uva 11178 - Morley's Theorem(几何)
- Uva 11178 Morley's Theorem (几何+模拟)
- UVA 11178 Morley's Theorem(几何)
- 11178 - Morley's Theorem【几何】
- uva 11178 Morley's Theorem(计算几何-点和直线)
- UVA 11178 Morley’s Theorem(莫雷定理 计算几何)
- 算法空间复杂度
- OpenLayers项目分析------------- 数据解析——以GML为例
- C++中cin的使用
- Ubuntu 12.04 安装 Gnome 3 桌面
- 高斯消元法与高斯约旦消元法
- UVA 11178 - Morley's Theorem 简单的计算几何
- 写给那些学校不是985、211的同学们
- OpenLayers--------------数据渲染分析
- java中String的常用方法
- HDU1845 Jimmy’s Assignment 984ms 飘过啊 汗死 二分匹配最大匹配数
- ORA-01843: not a valid month 错误的解决方案
- UVALive 3942 Remember the Word 字典树DP&&前缀树
- 算法导论小结(8)-动态规划与贪心算法
- java 转义字符