UVAoj 11178Morley's Theorem
来源:互联网 发布:怎么做图书marc数据 编辑:程序博客网 时间:2024/05/01 14:23
人生中第一道正式的计算几何题,用的刘汝佳的模板,纪念,继续努力
#include<cstdio>#include<cmath>struct Point { double x, y; Point(double x=0, double y=0):x(x),y(y) { }};typedef Point Vector;Vector operator + (const Vector& A, const Vector& B) { return Vector(A.x+B.x, A.y+B.y); }Vector operator - (const Point& A, const Point& B) { return Vector(A.x-B.x, A.y-B.y); }Vector operator * (const Vector& A, double p) { return Vector(A.x*p, A.y*p); }double Dot(const Vector& A, const Vector& B) { return A.x*B.x + A.y*B.y; }double Length(const Vector& A) { return sqrt(Dot(A, A)); }double Angle(const Vector& A, const Vector& B) { return acos(Dot(A, B) / Length(A) / Length(B)); }double Cross(const Vector& A, const Vector& B) { return A.x*B.y - A.y*B.x; }Point GetLineIntersection(const Point& P, const Point& v, const Point& Q, const Point& w) { Vector u = P-Q; double t = Cross(w, u) / Cross(v, w); return P+v*t;}Vector Rotate(const Vector& A, double rad) { return Vector(A.x*cos(rad)-A.y*sin(rad), A.x*sin(rad)+A.y*cos(rad));}Point read_point() { double x, y; scanf("%lf%lf", &x, &y); return Point(x,y);}Point getp(Point a,Point b,Point c){ double rad = Angle(b - a,c - a); Vector v = Rotate(c - a,rad / 3); rad = Angle(b - c,a - c); Vector v1 = Rotate(a - c,-rad / 3); return GetLineIntersection(a,v,c,v1);}int main() { int T; Point a, b, c, d, e, f; scanf("%d", &T); while(T--) { a = read_point(); b = read_point(); c = read_point(); d = getp(b, a, c); e = getp(c, b, a); f = getp(a, c, b); printf("%.6f %.6f %.6f %.6f %.6f %.6f\n", d.x, d.y, e.x, e.y, f.x, f.y); } return 0;}
0 0
- UVAoj 11178Morley's Theorem
- UVAOJ 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-11178Morley'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
- 例说linux内核与应用数据通信(一):添加一个系统调用
- Android性能调优工具TraceView介绍
- 文章标题
- javascript-jquery插件--FlexGrid 用法参数
- QT跨线程的信号与槽[2]---后台SOCKET
- UVAoj 11178Morley's Theorem
- mysql 数据表的基本操作
- cdev_init和cdev_add之后在/dev目录下没有长出设备节点原因
- Android内存监测工具DDMS->Heap,内存分析工具->MAT
- XtraBackup 实现不停机不锁表搭建mysql主从
- 深入理解Java注解(2):高级应用
- POJ 1423.Big Number
- FZU 2177 动态规划
- 网络的五层协议体系---互联网协议入门