[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\) ...
随机推荐
- java之finally的用法
package com.smbea.demo.tryCatchFinally; /** * java之finally的用法 * @author hapday * @2017年2月5日 @上午12:21 ...
- SQL SERVER 错误代码 0x534
解决办法就是修改一下登陆名: ALTER LOGIN [G-PC\zqwang] WITH NAME=[新的机器名\zqwang]; 然后查询一下 Service Broker 队列, 里面已经有 ...
- 如何让MVC和多层架构和谐并存(二)
上一节说了一些笼统的东西,这节说一些实际的操作. 1.取列表.这是一个新闻列表: 对应MVC的model是: public class NewsListModel { /// < ...
- MYSQL导入excel
MYSQL使用navicat导入excel 第一步:首先需要准备好有数据的excel 第二步:选择"文件"->"另存为",保存为"CSV(逗号分 ...
- mysql 5.6 zip安装,启动失败,1067错误
在使用mysql5.6 zip压缩包安装mysql过程中,启动过程,老是卡在1067启动错误上,翻看网上各种解决方案,卸载干净重装,重启,都不管用. 网上各种教程都是新建 my.ini mysql 配 ...
- April 21 2017 Week 16 Friday
Courage is like a muscle. We strengthen it with use. 勇气就像肌肉,越使用越强大. Most often it is true, but somet ...
- JAVA对list集合进行排序Collections.sort()
对一个集合中的对象进行排序,根据对象的某个指标的大小进行升序或降序排序.代码如下: // 进行降序排列 Collections.sort(list, new Comparator<ResultT ...
- A. Round House_数学问题
A. Round House time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- Codeforces Round #347 (Div.2)_B. Rebus
题目链接:http://codeforces.com/contest/664/problem/B B. Rebus time limit per test 1 second memory limit ...
- Action 语法的简介
https://www.cnblogs.com/LipeiNet/p/4694225.html https://www.cnblogs.com/Gyoung/archive/2013/04/04/29 ...