[Uva11178]Morley's Theorem(计算几何)
Description
Solution
计算几何入门题
只要求出三角形DEF的一个点就能推出其他两个点
把一条边往内旋转a/3度得到一条射线,再做一条交点就是了
Code
#include <cstdio>
#include <algorithm>
#include <cmath>
#define db double
using namespace std;
struct Po{
	db x,y;
	Po(db x=0,db y=0):x(x),y(y){}
};
typedef Po Ve;
Ve operator - (Po A,Po B){return Ve(A.x-B.x,A.y-B.y);}
Ve operator + (Ve A,Ve B){return Ve(A.x+B.x,A.y+B.y);}
Ve operator * (Ve A,db p){return Ve(A.x*p,A.y*p);}
Ve operator / (Ve A,db p){return Ve(A.x/p,A.y/p);}
Po read_p(){
	Po res;
	scanf("%lf%lf",&res.x,&res.y);
	return res;
}
db Dot(Ve A,Ve B){return A.x*B.x+A.y*B.y;}
db Len(Ve A){return sqrt(Dot(A,A));}
db Angle(Ve A,Ve B){return acos(Dot(A,B)/Len(A)/Len(B));}
Ve Rotate(Ve A,db rad){
	return Ve(A.x*cos(rad)-A.y*sin(rad),A.x*sin(rad)+A.y*cos(rad));
}
db Corss(Ve A,Ve B){return A.x*B.y-A.y*B.x;}
Po GetIntersection(Po P,Ve v,Po Q,Ve w){
	Ve u=P-Q;
	db t=Corss(w,u)/Corss(v,w);
	return P+v*t;
}
Po getD(Po A,Po B,Po C){
	Ve v1=C-B;
	db a1=Angle(A-B,v1);
	v1=Rotate(v1,a1/3);
	Ve v2=B-C;
	db a2=Angle(A-C,v2);
	v2=Rotate(v2,-a2/3);//负数表示顺时针旋转 
	return GetIntersection(B,v1,C,v2);
}
void print(Po P){printf("%.6lf %.6lf ",P.x,P.y);}
int main(){
	int T;
	scanf("%d",&T);
	Po A,B,C,D,E,F;
	while(T--){
		A=read_p();
		B=read_p();
		C=read_p();
		D=getD(A,B,C);
		E=getD(B,C,A);
		F=getD(C,A,B);
		print(D);print(E);print(F);puts("");
	}
	return 0;
}
[Uva11178]Morley's Theorem(计算几何)的更多相关文章
- uva11178 Morley’s Theorem(求三角形的角三分线围成三角形的点)
		Morley’s Theorem Input: Standard Input Output: Standard Output Morley’s theorem states that that the ... 
- UVA11178 Morley's Theorem(基础模板)
		题目链接 题意:给出A,B, C点坐标求D,E,F坐标,其中每个角都被均等分成三份 求出 ABC的角a, 由 BC 逆时针旋转 a/3 得到BD,然后 求出 ACB 的角a2, 然后 由 BC顺时 ... 
- UVA11178 Morley's Theorem
		题意 PDF 分析 就按题意模拟即可,注意到对称性,只需要知道如何求其中一个. 注意A.B.C按逆时针排列,利用这个性质可以避免旋转时分类讨论. 时间复杂度\(O(T)\) 代码 #include&l ... 
- UVA 11178  Morley's Theorem  计算几何模板
		题意:训练指南259页 #include <iostream> #include <cstdio> #include <cstring> #include < ... 
- UVA 11178 Morley's Theorem (计算几何)
		题目链接 lrj训练指南 P259 //==================================================================== Point getP( ... 
- uva 11178 - Morley's Theorem
		http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ... 
- UVA 11178 Morley's Theorem(几何)
		Morley's Theorem [题目链接]Morley's Theorem [题目类型]几何 &题解: 蓝书P259 简单的几何模拟,但要熟练的应用模板,还有注意模板的适用范围和传参不要传 ... 
- UVa 11178:Morley’s Theorem(两射线交点)
		Problem DMorley’s TheoremInput: Standard Input Output: Standard Output Morley’s theorem states that ... 
- UVA 11178 Morley's Theorem (坐标旋转)
		题目链接:UVA 11178 Description Input Output Sample Input Sample Output Solution 题意 \(Morley's\ theorem\) ... 
随机推荐
- 【菜鸟学Linux】Cron Job定期删除Log(日志)文件
			以前一直做Windows开发,近期的项目中要求使用Linux.作为小菜鸟一枚,赶紧买了一本经典书<鸟哥的Linux私房菜>学习.最近刚好有一个小任务 - 由于产品产生的Log很多,而且增长 ... 
- hibernate 模拟实现和What is and Why O/R Mapping
			What is and Why O/R Mapping What is : 用面向对象的方式调用api,类库帮我们翻译成面向关系的方式. Why: 1.JDBC操作数据库很繁琐2.Sql 语句编写并不 ... 
- nginx-1.12.2编译安装指导
			nginx-1.12.2编译安装 下载源码包 安装 安装后配置 下载源码包 下载地址:http://nginx.org/en/download.html nginx-1.12.2:http://ngi ... 
- 我的java开发规范
			关于文件的命名参考阮一峰的这篇文章:http://www.ruanyifeng.com/blog/2017/02/filename-should-be-lowercase.html,文中说文件名全部使 ... 
- 数组模拟栈(C语言)
			用数组模拟栈的实现: #include <stdio.h> #include <stdlib.h> #define STACK_SIZE 100 typedef struct ... 
- VM(xp系统下用虚拟机安装win8 提示 :units specified don't exist, SHSUCDX can't install)解决方法
			改成IDE的模式 
- 给网站添加图标: Font Awesome
			先贴上各种图标的网址:https://fontawesome.com/?from=io 1.打开网址,我们可以看到: 像我这种英语不好的,直接用谷歌浏览器进行翻译中文好了,自己还是有点B数的····· ... 
- 正则表达式转换python2的print为python3风格
			直接查找 print ([^\n\(]*)替换为 print($1) 
- 22 Swap Nodes in Pairs
			Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2-&g ... 
- OJ网站
			没事做做题是打发时间的好办法,还能练习下思维,效益很不错,但就是耗时 就选了3个oj,多了眼花缭乱 https://www.vijos.org/ http://uoj.ac/ https://leet ... 
