uva 11178(几何)
就是几何板子,刚学,真恶心。不说了,刘汝嘉牛逼。
#include <iostream> #include <cstring> #include <algorithm> #include <cstdio> #include <cmath> using namespace std; struct Point {double x,y;Point(double a=0,double b=0):x(a),y(b) {} }; typedef Point Vector; 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); } double Dot(Point A,Point B) { return A.x*B.x+A.y*B.y; } double Cross(Vector A,Vector B) { return A.x*B.y-A.y*B.x; } double Length(Vector A) { return sqrt(Dot(A,A)); } double Angle(Vector A,Vector B) { return acos(Dot(A,B)/Length(A)/Length(B)); } Vector Rotate(Point A,double rad) { return Vector(A.x*cos(rad)-A.y*sin(rad),A.x*sin(rad)+A.y*cos(rad)); } Point Getlineintersectoin(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 getD(Point A,Point B,Point C) {Vector v1=C-B;double rad=Angle(A-B,v1);v1=Rotate(v1,rad/3.0);Vector v2=B-C;rad=Angle(A-C,v2);v2=Rotate(v2,-rad/3.0);// printf("%.6lf %.6lf\n",v2.x,v2.y);Point mm=Getlineintersectoin(B,v1,C,v2);return mm;// printf("%.6lf %.6lf\n",mm.x,mm.y); } int main() {int T;Point A,B,C,D,E,F;scanf("%d",&T);while(T--){scanf("%lf%lf%lf%lf%lf%lf",&A.x,&A.y,&B.x,&B.y,&C.x,&C.y);D=getD(A,B,C);E=getD(B,C,A);F=getD(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/Wangwanxiang/p/7687722.html
uva 11178(几何)相关推荐
- Uva 11178 Morley's Theorem 向量旋转+求直线交点
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=9 题意: Morlery定理是这样的:作三角形ABC每个 ...
- 莫利定理:UVa 11178 Morley's Theorem
莫利定理(Morley's theorem),也称为莫雷角三分线定理.将三角形的三个内角三等分,靠近某边的两条三分角线相交得到一个交点,则这样的三个交点可以构成一个正三角形.这个三角形常被称作莫利正三 ...
- UVA 11178 Morley’s Theorem(莫雷定理 计算几何)
Morley's Theorem Input: Standard Input Output: Standard Output Morley's theorem states that that the ...
- Uva 11178 Morley定理
题意: 给你三角形三个点, 定理是 三个内角的三等分线相交得出 DEF三点, 三角新 DFE是等边三角形 然后要你输出 D E F 的坐标 思路 : 求出三个内角,对于D 相当于 BC向量逆时针旋转, ...
- 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(计算几何基础)
题目链接: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< ...
- 基于OpenVINO工具套件简单实现YOLOv7预训练模型的部署_附带预训练模型
●一.YOLOv7简介● 查看全文 http://www.taodudu.cc/news/show-7092220.html 相关文章: 轻量型目标检测算法总结 中交路桥科技浅谈:边坡稳定的影响因素及 ...
- UVa 11971 - Polygon(几何概型 + 问题转换)
链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
最新文章
- 开发经理 VS 敏捷专家
- LuoguP3183 [HAOI2016]食物链 记忆化搜索
- debian安装python3_debian上安装python3.6
- python获取时间周数_【手把手教你】Python量化策略风险指标
- tsp 分支界限 java_干货 | 10分钟教你用branch and bound(分支定界)算法求解TSP旅行商问题...
- vue 2.6 中 slot 的新用法
- 54.get set
- Xvfb 虚拟现实库 之 Python 虚拟桌面 pyvirtualdisplay
- arm shellcode 编写详析1
- [存档]获取通讯录信息并写到SD卡上
- 直播卖房和VR看房,到底是噱头还是新趋势?
- oracle 的自增需要依靠序列和触发器共同实现
- Linux之|etc|group文件
- python数据分类聚类案例_Python 数据分类与聚类分析(5)
- QPainter绘图基本使用
- 奇迹服务器如何修改爆率,奇迹萌新教程系列-奇迹装备是否掉落配置调整
- Flutter对话框(AlertDialog,SimpleDialog,showModalBottomSheet,showToast)以及定时器
- 手写实现数据库连接池
- Zabbix监控端口
- 今日学习在线编程题:古人的剩余定理
热门文章
- [BAT] 执行xcopy命令后出现Invalid num of parameters错误的解决办法
- VB6 如何连接MYSQL数据库
- Android状态选择器用法总结
- C#面试题 之 判断质数
- daily scrum 11.9
- ASP.NET异常全记录-----回发或回调参数无效
- Spark Streaming之运行架构
- 不同网段Linux通过路由表,Linux服务器架设---《路由表配置,实现不同网段不同网卡之间的ping...
- (64)FPGA面试题-在Verilog中,$display语句可以使用哪些不同的选项?
- FPGA跨时钟域处理方法延迟法