Morley's Therorem(UVA11178+几何)


题意: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+几何)的更多相关文章
- UVA 11178 Morley's Theorem(几何)
Morley's Theorem [题目链接]Morley's Theorem [题目类型]几何 &题解: 蓝书P259 简单的几何模拟,但要熟练的应用模板,还有注意模板的适用范围和传参不要传 ...
- 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顺时 ...
- UVa 11178 Morley's Theorem (几何问题)
题意:给定三角形的三个点,让你求它每个角的三等分线所交的顶点. 析:根据自己的以前的数学知识,应该很容易想到思想,比如D点,就是应该求直线BD和CD的交点, 以前还得自己算,现在计算机帮你算,更方便, ...
- UVA11178 Morley's Theorem
题意 PDF 分析 就按题意模拟即可,注意到对称性,只需要知道如何求其中一个. 注意A.B.C按逆时针排列,利用这个性质可以避免旋转时分类讨论. 时间复杂度\(O(T)\) 代码 #include&l ...
- [Uva11178]Morley's Theorem(计算几何)
Description 题目链接 Solution 计算几何入门题 只要求出三角形DEF的一个点就能推出其他两个点 把一条边往内旋转a/3度得到一条射线,再做一条交点就是了 Code #include ...
- 简单几何(求交点) 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 ...
- 关于Three.js基本几何形状之SphereGeometry球体学习
一.有关球体SphereGeometry构造函数参数说明 <1>.SphereGeometry(radius, widthSegments, heightSegments, phiStar ...
随机推荐
- Linux 防火墙相关
1.SELinux 防火墙 1.1 查看SELinux状态: 1) /usr/sbin/sestatus -v ##如果SELinux status参数为enabled即为开启状态 bamb ...
- NET Core微服务之路:再谈分布式系统中一致性问题分析
前言 一致性:很多时候表现在IT系统中,通常在分布式系统中,必须(或最终)为多个节点的数据保持一致.世间万物,也有存在相同的特征或相似,比如儿时的双胞胎,一批工厂流水线的产品,当然,我们不去讨论非IT ...
- 一个友盟BUG的思考和分析:Invalid update
1.友盟错误信息 Invalid update: invalid number of rows . The number of rows contained ) must be equal to th ...
- Rabbit RPC 代码阅读(一)
前言 因为想对RPC内部的机制作一个了解,特作以下阅读代码日志,以备忘. RPC介绍 Rabbit RPC 原理可以用3点概括: 1.服务端启动并且向注册中心发送服务信息,注册中心收到后会定时监控服务 ...
- Android 实现手写板技术
Android手写板和涂鸦的功能,代码如下: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/andro ...
- Android基础-系统架构分析,环境搭建,下载Android Studio,AndroidDevTools,Git使用教程,Github入门,界面设计介绍
系统架构分析 Android体系结构 安卓结构有四大层,五个部分,Android分四层为: 应用层(Applications),应用框架层(Application Framework),系统运行层(L ...
- [CocoaPods]使用Gemfile
RubyGems + Bundler 对于许多人来说,CocoaPods是编程项目中依赖管理的第一个介绍.CocoaPods的很多想法来自类似的项目(例如RubyGems,Bundler,npm和Gr ...
- Qt之使用CQU库快速开发统一风格界面
在使用Qt开发时,肯定是想让开发的项目界面统一风格:不希望每个界面都要程序员用代码去修饰美化以及进行事件处理等等,这样非常繁琐,容易出错而且没有格调:所以我就开发一个动态链接库,封装统一的风格界面.事 ...
- Springboot中读取.yml文件
自定义配置文件application-dev.yml spring: dataresource: druid: driver-class-name: com.mysql.jdbc.Driver url ...
- 内存管理buddy[原理]
TODO------------------------------------------------------------------------------------------------ ...