题意:训练指南259页

  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstring>
  4. #include <algorithm>
  5. #include <cmath>
  6.  
  7. using namespace std;
  8.  
  9. const double eps=1e-8;
  10.  
  11. int dcmp(double x)
  12. {
  13. if(fabs(x)<eps) return 0; else return (x<0)?-1:1;
  14. }
  15.  
  16. struct Point
  17. {
  18. double x,y;
  19. Point(double _x=0,double _y=0):x(_x),y(_y){}
  20. };
  21.  
  22. Point operator+(Point A,Point B) {return Point(A.x+B.x,A.y+B.y);}
  23. Point operator-(Point A,Point B) {return Point(A.x-B.x,A.y-B.y);}
  24. Point operator*(Point A,double p) {return Point(A.x*p,A.y*p);}
  25. Point operator/(Point A,double p) {return Point(A.x/p,A.y/p);}
  26.  
  27. Point A,B,C;
  28.  
  29. double Dot(Point A,Point B) {return A.x*B.x+A.y*B.y;}
  30. double Length(Point A) {return sqrt(Dot(A,A));}
  31. double Angle(Point A,Point B) {return acos(Dot(A,B)/Length(A)/Length(B));}
  32. double angle(Point v) {return atan2(v.y,v.x);}
  33. double Cross(Point A,Point B) {return A.x*B.y-A.y*B.x;}
  34.  
  35. Point Rotate(Point A,double rad)
  36. {
  37. return Point(A.x*cos(rad)-A.y*sin(rad),A.x*sin(rad)+A.y*cos(rad));
  38. }
  39.  
  40. Point GetLineIntersection(Point p,Point v,Point q,Point w)
  41. {
  42. Point u=p-q;
  43. double t=Cross(w,u)/Cross(v,w);
  44. return p+v*t;
  45. }
  46.  
  47. Point getD(Point A,Point B,Point C)
  48. {
  49. Point v1=C-B;
  50. double a1=Angle(A-B,v1);
  51. v1=Rotate(v1,a1/3);
  52.  
  53. Point v2=B-C;
  54. double a2=Angle(A-C,v2);
  55. v2=Rotate(v2,-a2/3);
  56.  
  57. return GetLineIntersection(B,v1,C,v2);
  58. }
  59.  
  60. void read(Point &a)
  61. {
  62. scanf("%lf %lf",&a.x,&a.y);
  63. }
  64. int main()
  65. {
  66. int cas;
  67. scanf("%d",&cas);
  68. while(cas--)
  69. {
  70. Point a,b,c,d,e,f;
  71. read(a);
  72. read(b);
  73. read(c);
  74. d=getD(a,b,c);
  75. e=getD(b,c,a);
  76. f=getD(c,a,b);
  77. printf("%.6f %.6f %.6f %.6f %.6f %.6f\n",d.x,d.y,e.x,e.y,f.x,f.y);
  78. }
  79. return 0;
  80. }

  

UVA 11178 Morley's Theorem 计算几何模板的更多相关文章

  1. UVA 11178 Morley's Theorem (计算几何)

    题目链接 lrj训练指南 P259 //==================================================================== Point getP( ...

  2. uva 11178 - Morley's Theorem

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

  3. UVA 11178 Morley's Theorem (坐标旋转)

    题目链接:UVA 11178 Description Input Output Sample Input Sample Output Solution 题意 \(Morley's\ theorem\) ...

  4. UVA 11178 Morley's Theorem(几何)

    Morley's Theorem [题目链接]Morley's Theorem [题目类型]几何 &题解: 蓝书P259 简单的几何模拟,但要熟练的应用模板,还有注意模板的适用范围和传参不要传 ...

  5. UVa 11178:Morley’s Theorem(两射线交点)

    Problem DMorley’s TheoremInput: Standard Input Output: Standard Output Morley’s theorem states that ...

  6. UVA 11178 - Morley's Theorem 向量

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

  7. UVA 11178 Morley's Theorem(旋转+直线交点)

    题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18543 [思路] 旋转+直线交点 第一个计算几何题,照着书上代码打 ...

  8. Uva 11178 Morley's Theorem 向量旋转+求直线交点

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=9 题意: Morlery定理是这样的:作三角形ABC每个 ...

  9. UVa 11178 Morley's Theorem (几何问题)

    题意:给定三角形的三个点,让你求它每个角的三等分线所交的顶点. 析:根据自己的以前的数学知识,应该很容易想到思想,比如D点,就是应该求直线BD和CD的交点, 以前还得自己算,现在计算机帮你算,更方便, ...

随机推荐

  1. Linux学习笔记(15)Linux字符集(locale,LANG,LC_ALL)

    关键词:linux系统修改编码,linux字符集问题, 目录  零.什么是locale 一.locale的详细内容 二.理解locale的设置 三 具体设定locale的方法(zh_CN.UTF-8. ...

  2. (4.15)mysql备份还原——物理备份之XtraBackup的下载与安装

    关键词:mysql物理备份,XtraBackup,XtraBackup安装,XtraBackup下载 实践链接:https://www.cnblogs.com/gered/p/11147193.htm ...

  3. WijmoJS 以声明方式添加 Vue 菜单项

    WijmoJS 以声明方式添加 Vue 菜单项 在V2019.0 Update2 的全新版本中,Vue框架下 WijmoJS 的前端UI组件功能得到再度增强. 如今,向wj菜单组件添加项的方法将不限于 ...

  4. 面向对象编程 OOP

    OOP,Object Oriented Programming,原来就是面向对象的编程. 面向对象是一种对现实世界理解和抽象的方法,是计算机编程技术发展到一定阶段后的产物. OOD,Object Or ...

  5. 【计算机网络】-介质访问子层-(信道划分介质访问控制&随机访问介质访问控制)

    [计算机网络]-介质访问子层-概述 介质访问控制子层功能 解决信道争用的协议,即用于多路访问信道上确定下一个使用者的协议 是数据链路层协议的一部分 介质访问控制子层位置 位于数据链路层的底部! 信道分 ...

  6. 基于Hadoop伪分布式集群搭建Spark

    一.前置安装 1)JDK 2)Hadoop伪分布式集群 二.Scala安装 1)解压Scala安装包 2)环境变量 SCALA_HOME = C:\ProgramData\scala-2.10.6 P ...

  7. http的导图

  8. MySQL性能优化(五):分表

    原文:MySQL性能优化(五):分表 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/vbi ...

  9. vue学习【一】vue引用封装echarts并展示多个echarts图表

    大家好,我是一叶,经过一段时间对vue的学习,我打算把vue做一个系列,把踩过的坑和大家分享一下. 现在开始第一章:vue引用并封装echarts 在文章开始前,我先舔波echarts(真香).阿里的 ...

  10. openlayers之点,线,面(以城市,河流,省份为例,分别对应点线面)

    kpst._this这里指向初始化的map // 设置标注样式函数 function createStyle(name) { // 河流style var riverStyle = new Style ...