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 [思路] 旋转+直线交点 第一个计算几何题,照着书上代码打 ...
随机推荐
- Centos6下安装中文字体
先安装字体管理软件 [root@localhost ~]# yum install fontconfig 将需要安装的字体放到/usr/share/fonts/chinese/目录下 如果不存在这个目 ...
- Dictionary与SortedDictionary
Dictionary是无序的,如果想排序,需要使用SortDictionary. 下面是一个用法示例 //按照某个字段排序 public void SortByCardItem(string item ...
- matlab二维绘图学习摘要
1.二维图形plot plot(x1,y1,x2,y2) —— 多条曲线绘图格式 plot(x,y,’s’) —— 开关格式,开关量字符串s设定曲线颜色和绘图方式,使用颜色字符串的前1~3个字母, ...
- ROI Pooling层详解
目标检测typical architecture 通常可以分为两个阶段: (1)region proposal:给定一张输入image找出objects可能存在的所有位置.这一阶段的输出应该是一系列o ...
- influxdb
1.安装Centos# wget https://dl.influxdata.com/influxdb/releases/influxdb-1.1.0.x86_64.rpm# rpm -ivh inf ...
- 在PHP中使用CURL,“撩”服务器只需几行
在PHP中使用CURL,“撩”服务器只需几行https://segmentfault.com/a/1190000006220620 七夕啦,作为开发,妹子没得撩就“撩”下服务器吧,妹子有得撩的同学那就 ...
- MongoDB初探-基本语句和数据结构
MySQL: 1 金老板 18 15512351234 2 小哪吒 20 15312341234 3 Alex 73 15512341234 MongoDB: { { id : 1, name:金老板 ...
- luogu P4314 CPU监控
传送门 这是个远古巨坑阿qwq 没有历史最大值还是能比较好做的.可能会有一个想法,就是直接维护线段树每个结点出现过的历史最大值,每次最大值变化就更新.但是有个问题:可能一个点能影响历史最大值的标记还没 ...
- Python使用的技巧
1. 给你一个字符串 a, 请你输出逆序之后的a. 例如:a=‘xydz’ 则输出:zdyx a=a[::-1] print(a) 扩展:Python切片操作. 2. 给你两个正整数a和b, 输出它们 ...
- scrapy框架的每个模块的用途
## 一.scrapy框架的每个模块的用途 1.spiders: 自定义爬虫 定义允许爬取的范围 定义开始爬取的url parse:一定要重写 start_request:一般不需要重写,可以通过重写 ...