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 [思路] 旋转+直线交点 第一个计算几何题,照着书上代码打 ...
随机推荐
- oracle修改密码为永久不过期
sqlplus /as sysdba ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
- maven打包可执行jar文件运行报错
起因 项目中同时依赖了Spring和MyBatis,并使用mybatis-spring集成MyBatis和Spring. 使用maven打包为可执行jar文件运行,打包插件为:maven-shade- ...
- ueditor 百度编辑器 粘贴的table表格样式边线
粘贴html的table表格会有间隔大,黑色边线,可以在: ueditor.all.js 里 找到以下处,修改里面的样式即可 me.ready(function () { utils.cssRule( ...
- Ext.net资源地址
nuget:https://www.nuget.org/packages/Ext.NET/4.1.0 示例:https://examples1.ext.net/#/GridPanel/WebServi ...
- 【转】const int *p和int * const p的区别(常量指针与指向常量的指针)
[转]作者:xwdreamer 出处:http://www.cnblogs.com/xwdreamer 对于指针和常量,有以下三种形式都是正确的: const char * myPtr = &am ...
- 关于PHP中的全局变量global和$GLOBALS的不同区分
1.global Global的作用是定义全局变量,但是这个全局变量不是应用于整个网站,而是应用于当前页面,包括include或require的所有文件. 但是在函数体内定义的global变量,函数体 ...
- 通过GUI制作一个简单的消息对话框互发消息
public class LTS extends JFrame { private JPanel contentPane; private JTextField textField; private ...
- MacOS下安装小米SQL优化工具soar
1 下载源码包 赋予权限 wget https://github.com/XiaoMi/soar/releases/download/0.11.0/soar.darwin-amd64 -O soar ...
- MySql数据库学习笔记(2)
DELETE 语法:delete from 表名 [where condition] delete from grade; TRUNCATE 用于完全清空表数据,但表结构.索引.约束不变: 语法: t ...
- jq的load
1.用于监听加载是否完成 当指定的元素(及子元素)已加载时,会发生 load() 事件. 该事件适用于任何带有 URL 的元素(比如图像.脚本.框架.内联框架). 根据不同的浏览器(Firefox 和 ...