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-11; struct Point {double x, y;Point(double x = 0, double y = 0) : x(x), y(y) {} }; typedef Point Vector;int dcmp(double x) { if(fabs(x) < eps) return 0 ; else return x < 0 ? -1 : 1; }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) == 0 && dcmp(a.y-b.y) == 0; }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/3);Vector vv = B-C;rad = Angle(A-C,vv);vv = Rotate(vv, -rad/3);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 0; }
转载于:https://www.cnblogs.com/aoxuets/p/4742132.html
Uva 11178 Morley定理相关推荐
- 莫利定理:UVa 11178 Morley's Theorem
莫利定理(Morley's theorem),也称为莫雷角三分线定理.将三角形的三个内角三等分,靠近某边的两条三分角线相交得到一个交点,则这样的三个交点可以构成一个正三角形.这个三角形常被称作莫利正三 ...
- 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 Input: Standard Input Output: Standard Output Morley's theorem states that that the ...
- Uva 11178 Morley's Theorem 向量旋转+求直线交点
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=9 题意: Morlery定理是这样的:作三角形ABC每个 ...
- UVa 11178 Morley‘s Theorem(计算几何基础)
题目链接:https://www.luogu.com.cn/problem/UVA11178 有 T 组测试样例,输入 3 个点的坐标,A , B , C ,然后每两点确定一条直线,将每两条直线所形成 ...
- uva 11178 Morley's Theorem 三角形内角三等分线交点
给出一个三角形ABC的三个顶点坐标,共有6条内角三等分线:AF .AE. BF. BD. CE. CD,求点D.E.F的坐 标. #include<cstdio> #include< ...
- uva 11178(几何)
就是几何板子,刚学,真恶心.不说了,刘汝嘉牛逼. #include <iostream> #include <cstring> #include <algorithm&g ...
- 基于OpenVINO工具套件简单实现YOLOv7预训练模型的部署_附带预训练模型
●一.YOLOv7简介● 查看全文 http://www.taodudu.cc/news/show-7092220.html 相关文章: 轻量型目标检测算法总结 中交路桥科技浅谈:边坡稳定的影响因素及 ...
- linux 进程无法启动,linux6.*无法正常启动has进程解决方案
1. 数据库安装成功之后:发现ohasd进程存在异常: [root@oracle234 ~]# su - grid [grid@oracle234 ~]$ ps -ef| grep ohasd gri ...
最新文章
- Numpy入门教程:06. 排序,搜索和计数
- 利用PHPExcel转Excel柱形图
- VC四种程序启动画面的制作方法
- 学JS的心路历程 -函式(三)this
- Linux版本之挑选适合服务器的OS发行版
- 知识主题间先序关系挖掘
- 部署mysql MHA集群
- GlobalSign 团队与世界领先的认证机构(CAs)合作 共同加强网络安全
- Jquery 判断IE
- Android Metro风格的Launcher开发系列第一篇
- C/C++[codeup 2025]比较字符串
- segger 烧写superboot
- 删除 srvinstw安装的服务
- ubuntu18.04 64位安装itunes12
- 《嵌入式 - 嵌入式大杂烩》详解ROM和RAM
- 超级好用的 excel 导入导出框架:excel-import-export
- 关于微信数据库文件夹与资源文件夹名称的问题
- 火车头微博采集发布规则教程详解
- JAVA中浮点数取整数部分和取小数部分
- 【计算机组成原理-chapter1】计算机组成原理概述
热门文章
- poj 3331 关于阶乘运算
- 类似mysqlhotcopy备份mysql myisam脚本
- 牛刀:开发商不差钱不等于房价不暴跌 (转载)
- linux xorg 文件 位置,Linux系统中xorg.conf文件详细介绍
- linux服务器重启ctrl,Linux禁止Ctrl+Alt+Del重启
- 7 orm 有批量更新_2020.12.24更新公告
- xp速度比服务器系统,让Windows XP跑得更快更稳
- golang后端php前端,Golang如何接收前端的参数
- 数据科学入门与实战:Seaborn002热力图等
- java压缩传输gzip_服务器使用Gzip压缩数据,加快网络传输(Java 例子)