UVA 11178 Morley's Theorem(二维几何基础)
来源:互联网 发布:sdcms 域名未授权 编辑:程序博客网 时间:2024/05/29 02:11
题意:给定一个三角形,求每个角的三等分线相交形成的三角形的三个坐标
题解:直接模板
#include <cstdio>#include <iostream>#include <cstring>#include <string>#include <cstdlib>#include <algorithm>#include <cmath>#include <set>#include <list>#include <queue>using namespace std;#define L(i) i<<1#define R(i) i<<1|1const int N = 100005;const double eps = 1e-10;struct Point{ double x,y; Point(double x = 0,double y = 0):x(x),y(y){} Point operator +(Point a) { return Point(x + a.x,y + a.y); } Point operator -(Point a) { return Point(x - a.x,y-a.y); } Point operator *(double p) { return Point(x * p,y * p); }};int dcmp(double x){ if(fabs(x) < eps) return 0; else return x < 0 ? -1 : 1;}double Dot(Point A,Point B){ return A.x * B.x + A.y * B.y;}double Length(Point A){ return sqrt(Dot(A,A));}double Angle(Point A,Point B){ return acos(Dot(A,B) / Length(A) / Length(B));}double Cross(Point A,Point B){ return A.x*B.y - A.y*B.x;}Point Rotate(Point A,double rad){ return Point(A.x*cos(rad)-A.y*sin(rad),A.x*sin(rad)+A.y*cos(rad));}Point GetLineIntersection(Point P,Point v,Point Q,Point w){ Point u = P - Q; double t = Cross(w,u) / Cross(v,w); return P + v*t;}Point get(Point A,Point B,Point C){ Point v1 = C-B; double a1 = Angle(A-B,v1); //printf("%.6lf\n",a1); v1 = Rotate(v1,a1/3); //printf("%.6lf %.6lf\n",v1.x,v1.y); Point v2 = B-C; double a2 = Angle(A - C,v2); //printf("%.6lf\n",a2); v2 = Rotate(v2,-a2/3); //printf("%.6lf %.6lf\n",v2.x,v2.y); return GetLineIntersection(B,v1,C,v2);}int main(){ int t,n; scanf("%d",&t); Point A,B,C,D,E,F; while(t--) { scanf("%lf%lf%lf%lf%lf%lf",&A.x,&A.y,&B.x,&B.y,&C.x,&C.y); D = get(A,B,C); E = get(B,C,A); F = get(C,A,B); printf("%.6lf %.6lf %.6lf %.6lf %.6lf %.6lf\n",D.x,D.y,E.x,E.y,F.x,F.y); } return 0;}
0 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 - 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 简单的计算几何
- UVA 11178 Morley’s Theorem(计算几何直线的交点)
- uva 011178 Morley's Theorem 计算几何
- UVA 11178 Morley's Theorem(Morley定理)
- hdu 1005 -- Number Sequence
- 第4周实践项目1-- 建立单链表
- 第六周——项目一:建立顺序栈算法库
- 第六周项目1-建立顺序栈算法库
- 第6周—项目1 建立顺序栈算法库
- UVA 11178 Morley's Theorem(二维几何基础)
- 第4周实践项目1--建立单链表
- mybatis配置
- 回文树 (tsinsen A1280. 最长双回文串)
- java调用SAP PI webservice ,用户名密码认证
- 第四周上机实践—项目5—猴子选大王
- 第四周项目1 建立单链表
- jenkins配置----maven下载安装
- RecycleView的Item数据出现随机错乱重复问题解决