UVA 11178 Morley's Theorem 计算几何模板
- #include <iostream>
- #include <cstdio>
- #include <cstring>
- #include <algorithm>
- #include <cmath>
- using namespace std;
- const double eps=1e-8;
- int dcmp(double x)
- {
- if(fabs(x)<eps) return 0; else return (x<0)?-1:1;
- }
- struct Point
- {
- double x,y;
- Point(double _x=0,double _y=0):x(_x),y(_y){}
- };
- Point operator+(Point A,Point B) {return Point(A.x+B.x,A.y+B.y);}
- Point operator-(Point A,Point B) {return Point(A.x-B.x,A.y-B.y);}
- Point operator*(Point A,double p) {return Point(A.x*p,A.y*p);}
- Point operator/(Point A,double p) {return Point(A.x/p,A.y/p);}
- Point A,B,C;
- 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 angle(Point v) {return atan2(v.y,v.x);}
- 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 getD(Point A,Point B,Point C)
- {
- Point v1=C-B;
- double a1=Angle(A-B,v1);
- v1=Rotate(v1,a1/3);
- Point v2=B-C;
- double a2=Angle(A-C,v2);
- v2=Rotate(v2,-a2/3);
- return GetLineIntersection(B,v1,C,v2);
- }
- void read(Point &a)
- {
- scanf("%lf %lf",&a.x,&a.y);
- }
- int main()
- {
- int cas;
- scanf("%d",&cas);
- while(cas--)
- {
- Point a,b,c,d,e,f;
- read(a);
- read(b);
- read(c);
- d=getD(a,b,c);
- e=getD(b,c,a);
- f=getD(c,a,b);
- printf("%.6f %.6f %.6f %.6f %.6f %.6f\n",d.x,d.y,e.x,e.y,f.x,f.y);
- }
- return 0;
- }
UVA 11178 Morley's Theorem 计算几何模板的更多相关文章
- 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 (坐标旋转)
题目链接: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 DMorley’s TheoremInput: Standard Input Output: Standard Output Morley’s theorem states that ...
- 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(旋转+直线交点)
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18543 [思路] 旋转+直线交点 第一个计算几何题,照着书上代码打 ...
- Uva 11178 Morley's Theorem 向量旋转+求直线交点
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=9 题意: Morlery定理是这样的:作三角形ABC每个 ...
- UVa 11178 Morley's Theorem (几何问题)
题意:给定三角形的三个点,让你求它每个角的三等分线所交的顶点. 析:根据自己的以前的数学知识,应该很容易想到思想,比如D点,就是应该求直线BD和CD的交点, 以前还得自己算,现在计算机帮你算,更方便, ...
随机推荐
- Linux学习笔记(15)Linux字符集(locale,LANG,LC_ALL)
关键词:linux系统修改编码,linux字符集问题, 目录 零.什么是locale 一.locale的详细内容 二.理解locale的设置 三 具体设定locale的方法(zh_CN.UTF-8. ...
- (4.15)mysql备份还原——物理备份之XtraBackup的下载与安装
关键词:mysql物理备份,XtraBackup,XtraBackup安装,XtraBackup下载 实践链接:https://www.cnblogs.com/gered/p/11147193.htm ...
- WijmoJS 以声明方式添加 Vue 菜单项
WijmoJS 以声明方式添加 Vue 菜单项 在V2019.0 Update2 的全新版本中,Vue框架下 WijmoJS 的前端UI组件功能得到再度增强. 如今,向wj菜单组件添加项的方法将不限于 ...
- 面向对象编程 OOP
OOP,Object Oriented Programming,原来就是面向对象的编程. 面向对象是一种对现实世界理解和抽象的方法,是计算机编程技术发展到一定阶段后的产物. OOD,Object Or ...
- 【计算机网络】-介质访问子层-(信道划分介质访问控制&随机访问介质访问控制)
[计算机网络]-介质访问子层-概述 介质访问控制子层功能 解决信道争用的协议,即用于多路访问信道上确定下一个使用者的协议 是数据链路层协议的一部分 介质访问控制子层位置 位于数据链路层的底部! 信道分 ...
- 基于Hadoop伪分布式集群搭建Spark
一.前置安装 1)JDK 2)Hadoop伪分布式集群 二.Scala安装 1)解压Scala安装包 2)环境变量 SCALA_HOME = C:\ProgramData\scala-2.10.6 P ...
- http的导图
- MySQL性能优化(五):分表
原文:MySQL性能优化(五):分表 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/vbi ...
- vue学习【一】vue引用封装echarts并展示多个echarts图表
大家好,我是一叶,经过一段时间对vue的学习,我打算把vue做一个系列,把踩过的坑和大家分享一下. 现在开始第一章:vue引用并封装echarts 在文章开始前,我先舔波echarts(真香).阿里的 ...
- openlayers之点,线,面(以城市,河流,省份为例,分别对应点线面)
kpst._this这里指向初始化的map // 设置标注样式函数 function createStyle(name) { // 河流style var riverStyle = new Style ...