UVa 11178 (简单练习) Morley's Theorem
题意:
Morley定理:任意三角形中,每个角的三等分线,相交出来的三个点构成一个正三角形。
不过这和题目关系不大,题目所求是正三角形的三个点的坐标,保留6位小数。
分析:
由于对称性,求出D点,EF也是同样的。
用点和向量的形式表示一条直线,向量BA、BC的夹角为a1,则将BC逆时针旋转a1/3可求得 直线BD,同理也可求得直线CD,最后再求交点即可。
//#define LOCAL
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std; struct Point
{
double x, y;
Point(double x=, double y=) :x(x),y(y) {}
};
typedef Point Vector;
const double EPS = 1e-; 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); } Vector operator / (Vector A, double p) { return Vector(A.x/p, A.y/p); } bool operator < (const Point& a, const Point& b)
{ return a.x < b.x || (a.x == b.x && a.y < b.y); } int dcmp(double x)
{ if(fabs(x) < EPS) return ; else x < ? - : ; } bool operator == (const Point& a, const Point& b)
{ return dcmp(a.x-b.x) == && dcmp(a.y-b.y) == ; } 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 Angle(Vector A, Vector B)
{ return acos(Dot(A, B) / Length(A) / Length(B)); } double Cross(Vector A, Vector B)
{ return A.x*B.y - A.y*B.x; } double Area2(Point A, Point B, Point C)
{ return Cross(B-A, C-A); } Vector VRotate(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;
} Point read_point(void)
{
double x, y;
scanf("%lf%lf", &x, &y);
return Point(x, y);
} Point GetD(Point A, Point B, Point C)
{
Vector v1 = C - B;
double a1 = Angle(A-B, v1);
v1 = VRotate(v1, a1/); Vector v2 = B - C;
double a2 = Angle(A-C, v2);
v2 = VRotate(v2, -a2/); return GetLineIntersection(B, v1, C, v2);
} int main(void)
{
#ifdef LOCAL
freopen("11178in.txt", "r", stdin);
#endif int T;
scanf("%d", &T);
while(T--)
{
Point A, B, C, D, E, F;
A = read_point();
B = read_point();
C = read_point();
D = GetD(A, B, C);
E = GetD(B, C, A);
F = GetD(C, A, B);
printf("%.6lf %.6lf %.6lf %.6lf %.6lf %.6lf\n", D.x, D.y, E.x, E.y, F.x, F.y);
} return ;
}
代码君
UVa 11178 (简单练习) Morley's Theorem的更多相关文章
- 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 (坐标旋转)
		题目链接:UVA 11178 Description Input Output Sample Input Sample Output Solution 题意 \(Morley's\ theorem\) ... 
- UVA 11178 Morley's Theorem(几何)
		Morley's Theorem [题目链接]Morley's Theorem [题目类型]几何 &题解: 蓝书P259 简单的几何模拟,但要熟练的应用模板,还有注意模板的适用范围和传参不要传 ... 
- uva 11178 Morley's Theorem(计算几何-点和直线)
		Problem D Morley's Theorem Input: Standard Input Output: Standard Output Morley's theorem states tha ... 
- UVa 11178:Morley’s Theorem(两射线交点)
		Problem DMorley’s TheoremInput: Standard Input Output: Standard Output Morley’s theorem states that ... 
- uva11178 Morley’s Theorem(求三角形的角三分线围成三角形的点)
		Morley’s Theorem Input: Standard Input Output: Standard Output Morley’s theorem states that that the ... 
- uva 11178二维几何(点与直线、点积叉积)
		Problem D Morley’s Theorem Input: Standard Input Output: Standard Output Morley’s theorem states tha ... 
- 简单几何(求交点) UVA 11178 Morley's Theorem
		题目传送门 题意:莫雷定理,求三个点的坐标 分析:训练指南P259,用到了求角度,向量旋转,求射线交点 /*********************************************** ... 
- UVA 11178 - Morley's Theorem 向量
		http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ... 
随机推荐
- Windows 7 下配置IIS,并且局域网内可访问
			win7的iis很麻烦滴!我搭建过一次!不过有点问题!还是xp好! 一.进入Win7的 控制面板,选择左侧的 打开或关闭Windows功能 . 二.现在出现了安装Windows功能的选项菜单,注意选择 ... 
- 小王子浅读Effective javascript(一)了解javascript版本
			哈哈,各位园友新年快乐!愚安好久没在园子里写东西了,这次决定针对javascript做一个系列,叫做<小王子浅读Effective javascript>,主要是按照David Herma ... 
- NPOI读取Excel数据应用
			NPOI 是 POI 项目的 .NET 版本.使用 NPOI 你就可以在没有安装 Office 或者相应环境的机器上对 WORD/EXCEL 文档进行读写.NPOI是构建在POI 3.x版本之上的,它 ... 
- D2GS1.11 的DC Key的相關設置指南
			D2GS1.11版本暗黑戰網服務器DC Key 的相關設置是保存在 D2Server.ini 文件中的.在這裡我列舉跟DC Key 有關的配置條款. (以下內容具存在於D2Server.ini 文件中 ... 
- SQL Server 之 锁
			锁,是由锁管理器负责维护,其目的是保证事务的ACID,是平衡并发和数据安全的机制. 锁定粒度与并发性是成反比的,默认情况下,SQL Server Compact 4.0 对数据页使用行级锁定,对索引页 ... 
- PAT-乙级-1053. 住房空置率 (20)
			1053. 住房空置率 (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 在不打扰居民的前提下,统计住房空 ... 
- hdu 3807
			很好的思路 枚举有多少人有ipad 判是否满足题目给出的条件 #include <iostream> #include <cstring> #include <c ... 
- Unity3d 接入 移动MM支付SDK(2.3) 全攻略
			原地址:http://blog.csdn.net/dingxiaowei2013/article/details/26842177 先将例程运行起来 下载例程(csdn积分不够上传不了,只能用百度网盘 ... 
- struts2-2.3.4.1的struts-default.xml源码
			<?xml version="1.0" encoding="UTF-8" ?> <!-- /* * $Id: struts-default.x ... 
- 深入浅出ES6(四):模板字符串
			作者 Jason Orendorff github主页 https://github.com/jorendorff 反撇号(`)基础知识 ES6引入了一种新型的字符串字面量语法,我们称之为模板字符 ... 
