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 [思路] 旋转+直线交点 第一个计算几何题,照着书上代码打 ...
随机推荐
- STC等单片机一开机就停电模式烧写程序办法
为了测试一个低功耗程序,程序一开机就进入停机模式,结果刷不回来了,经过两个小时的试验,必须4个线同时插拔vcc,rxd,txd,gnd.如果只断开vcc是不行的.
- None.js 第四步 事件驱动程序
Node.js 有多个内置的事件,我们可以通过引入 events 模块,并通过实例化 EventEmitter 类来绑定和监听事件 // 导入events模块 var events = require ...
- vs不自动退出控制台程序的办法
1.在主函数rerurn 前加上getchar();即可. 2.ctrl+F5;
- 结构体类型struct
教学视频 定义: struct student{CString name; int num; TCHAR sex; int age; }; //注意有个分号 student zansan = {_ ...
- UE4 二维相关
SceneCapture2D (类似相机组件)可将视口内的图像转化为平面二维纹理资源渲染到 RenderTargetRenderTarget 可以被 Material直接使用例:做小地图SceneC ...
- Censys
Censys Censys持续监控互联网上所有可访问的服务器和设备,以便您可以实时搜索和分析它们,了解你的网络攻击面,发现新的威胁并评估其全球影响.从互联网领先的扫描仪ZMap的创造者来说,我们的使命 ...
- Python操作Redis数据库
连接数据库 StrictRedis from redis import StrictRedis # 使用默认方式连接到数据库 redis = StrictRedis(host='localhost', ...
- python加密(MD5)
# import hashlib # # 1. 创建一个MD5对象 # obj = hashlib.md5(b"flkjsdalkfjklasdjfklasjkflasdjklfasdjfl ...
- canvas粒子背景
- 在github上创建自己的项目
使用过很多次github 但一直是把别人的项目clone下来,并没有自己创建过项目.所以记录一下~ 首先,创建一个仓库 填写工程名之后就创建好啦 然后clone代码到本地 就和正常的使用完全一样啦 ~ ...