题意:Morley定理,求D、E、F的坐标

思路:没什么算法,就是几何的应用。注意旋转角就好了。

转载请注明出处:寻找&星空の孩子

题目链接:UVA11178

 #include<cstdio>
#include<cmath>
#define PI acos(-1.0)
using namespace std; struct Point
{
double x,y;
Point(double x=,double y=):x(x),y(y){ }
// Point read_point() {scanf("%lf%lf",&this.x,&this.y);}
};
typedef Point Vector;
Vector operator + (Vector A,Vector B){return Vector(A.x+B.x,A.y+B.y);}
Vector operator - (Point A,Point 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);} 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-B.x*A.y;} Vector Rotate (Vector A,double rad)
{
//其中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;
if(Cross(v,w))
{
double t=Cross(w,u)/Cross(v,w);//精度高的时候,考虑自定义分数类
return P+v*t;
}
// else
// return ;
} Point getD(Point A,Point B,Point C)
{
Vector v1=C-B;
double a1=Angle(A-B,v1);
v1=Rotate(v1,a1/); Vector v2=B-C;
double a2=Angle(A-C,v2);
v2=Rotate(v2,-a2/);//-表示顺时针旋转; return GetLineIntersection(B,v1,C,v2); } Point read_point(Point &P)
{
scanf("%lf%lf",&P.x,&P.y);
return P;
}
int main()
{
int T;
Point A,B,C,D,E,F;
scanf("%d",&T);
while(T--)
{
A=read_point(A);
B=read_point(B);
C=read_point(C); // scanf("%lf%lf%lf%lf%lf%lf",&A.x,&A.y,&B.x,&B.y,&C.x,&C.y);
// printf("%.6lf %.6lf %.6lf %.6lf %.6lf %.6lf\n",A.x,A.y,B.x,B.y,C.x,C.y);
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 ;
}

Morley's Therorem(UVA11178+几何)的更多相关文章

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

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

  2. uva11178 Morley’s Theorem(求三角形的角三分线围成三角形的点)

    Morley’s Theorem Input: Standard Input Output: Standard Output Morley’s theorem states that that the ...

  3. UVA11178 Morley's Theorem(基础模板)

    题目链接 题意:给出A,B, C点坐标求D,E,F坐标,其中每个角都被均等分成三份   求出 ABC的角a, 由 BC 逆时针旋转 a/3 得到BD,然后 求出 ACB 的角a2, 然后 由 BC顺时 ...

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

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

  5. UVA11178 Morley's Theorem

    题意 PDF 分析 就按题意模拟即可,注意到对称性,只需要知道如何求其中一个. 注意A.B.C按逆时针排列,利用这个性质可以避免旋转时分类讨论. 时间复杂度\(O(T)\) 代码 #include&l ...

  6. [Uva11178]Morley's Theorem(计算几何)

    Description 题目链接 Solution 计算几何入门题 只要求出三角形DEF的一个点就能推出其他两个点 把一条边往内旋转a/3度得到一条射线,再做一条交点就是了 Code #include ...

  7. 简单几何(求交点) UVA 11178 Morley's Theorem

    题目传送门 题意:莫雷定理,求三个点的坐标 分析:训练指南P259,用到了求角度,向量旋转,求射线交点 /*********************************************** ...

  8. uva 11178 - Morley's Theorem

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

  9. 关于Three.js基本几何形状之SphereGeometry球体学习

    一.有关球体SphereGeometry构造函数参数说明 <1>.SphereGeometry(radius, widthSegments, heightSegments, phiStar ...

随机推荐

  1. Linux下nautilus的右键快捷菜单项设置

    某一天我的Linux更新完后, 我照常在文件夹下点击右键想打开终端, 却发现右键快捷菜单没有Open in terminal的菜单项了. 在网上查找了一下, 结合自己系统的情况发现了解决办法. 由于我 ...

  2. NET Core微服务之路:简单谈谈对ELK,Splunk,Exceptionless统一日志收集中心的心得体会

    前言 日志,一直以来都是开发人员和运维人员最关心的问题.开发人员可通过日志记录来协助问题定位,运维人员可通过日志发现系统隐患,故障等定位问题.如果你的系统中没有日志,就像一个断了线的风筝,你永远不知道 ...

  3. Js之设置日期时间 判断日期是否在范围内

    var now = new Date(); var startDate = new Date(); startDate.setFullYear(2018, 08, 07); startDate.set ...

  4. 微信小程序scroll-view 横向和纵向scroll-view组件

    scroll-view为滚动视图,分为水平滚动和垂直滚动.注意滚动视图垂直滚动时一定要设置高度否则的话scroll-view不会生效.滚动视图常用的地方一般都是Item项比较多的界面,比如我的模块 主 ...

  5. Spring Boot开启的 2 种方式

    Spring Boot依赖 使用Spring Boot很简单,先添加基础依赖包,有以下两种方式 1. 继承spring-boot-starter-parent项目 <parent> < ...

  6. Maven 如何发布 jar 包到 Nexus 私库

    Nexus2可以通过管理界面来上传jar包到私库中,而最新的Nexus3却找不到了上传界面,只能通过以下方式来发布到私库. 发布第三方jar包 这种情况是maven远程仓库没有,本地有的第三方jar包 ...

  7. javascript编程中this解析

    一.为什么要使用this? this 提供了一种更优雅的方式来隐式"传递"一个对象引用,因此可以将 API 设计得更加简洁并且易于复用.随着你的使用模式越来越复杂,显式传递上下文对 ...

  8. [EXP]Drupal < 8.6.10 / < 8.5.11 - REST Module Remote Code Execution

    Analyzing the patch By diffing Drupal and , we can see that in the REST module, FieldItemNormalizer ...

  9. 疫苗:JAVA HASHMAP的死循环

    在淘宝内网里看到同事发了贴说了一个CPU被100%的线上故障,并且这个事发生了很多次,原因是在Java语言在并发情况下使用HashMap造成Race Condition,从而导致死循环.这个事情我4. ...

  10. IOS返回go(-1)

    IOS8和9,在用go(-1)返回的时候,会同时加载js.可能会造成js加载顺序出错,或者值被覆盖的情况,我们可以用setTimeout(function(){XXX代码},100);延时加载.