Uva 11178 Morley定理
题意: 给你三角形三个点, 定理是 三个内角的三等分线相交得出 DEF三点,
三角新 DFE是等边三角形
然后要你输出 D E F 的坐标
思路 :
求出三个内角,对于D 相当于 BC向量逆时针旋转, CB向量顺时针旋转 ,相交得到的点;
同理可以求出其他点 (LRJ 模板真强大)
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const double eps = 1e-;
struct Point {
double x, y;
Point(double x = , double y = ) : x(x), y(y) {}
};
typedef Point Vector; int dcmp(double x) { if(fabs(x) < eps) return ; else return x < ? - : ; } 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 ) ; }
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; } ///X积
double Area2 (Point A, Point B, Point C) { return Cross(B-A,C-A); } ///面积
Vector Rotate (Vector A, double rad) { ///向量旋转 , 逆时针,顺时针角度为-
return Vector(A.x*cos(rad)-A.y*sin(rad), A.x*sin(rad) + A.y*cos(rad)) ;
}
Vector Normal (Vector A) { double L = Length(A); return Vector(-A.y/L, A.x/L); } ///单位向量
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 GetPoint (Point A, Point B, Point C)
{
Vector v = C-B;
double rad = Angle(A-B,v);
v = Rotate(v, rad/); Vector vv = B-C;
rad = Angle(A-C,vv);
vv = Rotate(vv, -rad/); return GetLineIntersection(B,v, C,vv);
} int main()
{
int t;
scanf("%d",&t);
while(t--)
{
Point A, B, C, D, E, F;
cin >> A.x >> A.y >> B.x >>B.y >> C.x >>C.y;
D = GetPoint(A,B,C);
E = GetPoint(B,C,A);
F = GetPoint(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定理的更多相关文章
- 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://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(两射线交点)
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=9 题意: Morlery定理是这样的:作三角形ABC每个 ...
- 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(几何)
Morley's Theorem [题目链接]Morley's Theorem [题目类型]几何 &题解: 蓝书P259 简单的几何模拟,但要熟练的应用模板,还有注意模板的适用范围和传参不要传 ...
- 简单几何(求交点) UVA 11178 Morley's Theorem
题目传送门 题意:莫雷定理,求三个点的坐标 分析:训练指南P259,用到了求角度,向量旋转,求射线交点 /*********************************************** ...
- UVA 11178 Morley's Theorem(旋转+直线交点)
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18543 [思路] 旋转+直线交点 第一个计算几何题,照着书上代码打 ...
随机推荐
- Django之用户认证组件
auth模块 之前我们在进行用户登录验证的时候,都是自己写代码,接收用户提交的数据,然后去数据库取数据进行匹配验证,其实Django已经给我们提供了内置的用户认证功能.不信的话你可以打开models. ...
- [译]Walkthrough: Using MSBuild
原文 MSBuild是微软VS的Build平台. 你可以在Visual Studio或Windows命令行中运行MSBuild.在这我们使用VS创建一个MSBuild项目.你可以在VS中编辑项目文件, ...
- XXE攻防技术
http://bobao.360.cn/learning/detail/3841.html http://www.freebuf.com/articles/web/97833.html http:// ...
- 【杂】指针,*,&
一个小程序解释指针变量的作用: #include<iostream> #include"cww.h" void cloud(int *); using namespac ...
- mysql字符函数
1.CONCAT() 字符连接 (1)mysql> SELECT CONCAT('imooc', 'MYSQL');+--------------------------+| CONCAT(' ...
- [C++]Linux之网络实时检测功能
声明:如需引用或者摘抄本博文源码或者其文章的,请在显著处注明,来源于本博文/作者,以示尊重劳动成果,助力开源精神.也欢迎大家一起探讨,交流,以共同进步,乃至成为朋友- 0.0 由于学习操作系统实验课程 ...
- Codeforces Round #450 (Div. 2) C. Remove Extra One
题目链接 题意:让你去掉一个数,使得剩下的数的record最多,当1≤j<i的aj<ai1 \leq j< i的a_j<a_i1≤j<i的aj<ai时aia_i ...
- Kaldi的交叉熵正则化
xent_regularize, Cross Entropy Regularize nnet3/nnet-discriminative-trainning.cc:109 void NnetDiscri ...
- 登录mysql时的一些命令
清屏: cls 只要输入cls然后回车运行命令,可以清屏. 查看版本号: mysql -V 注意:V一定要大写,如果不大写就错了... 登录: mysql -u用户名 -p密码 -P端口号 -h数据库 ...
- jQuery插件整理
toastr:Jquery消息提示插件 http://codeseven.github.io/toastr cropperjs:jQuery简单且功能强大的图片剪裁插件 https://www.npm ...