UVA 11178 Morley's Theorem 计算几何模板
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath> using namespace std; const double eps=1e-8; int dcmp(double x)
{
if(fabs(x)<eps) return 0; else return (x<0)?-1:1;
} struct Point
{
double x,y;
Point(double _x=0,double _y=0):x(_x),y(_y){}
}; Point operator+(Point A,Point B) {return Point(A.x+B.x,A.y+B.y);}
Point operator-(Point A,Point B) {return Point(A.x-B.x,A.y-B.y);}
Point operator*(Point A,double p) {return Point(A.x*p,A.y*p);}
Point operator/(Point A,double p) {return Point(A.x/p,A.y/p);} Point A,B,C; double Dot(Point A,Point B) {return A.x*B.x+A.y*B.y;}
double Length(Point A) {return sqrt(Dot(A,A));}
double Angle(Point A,Point B) {return acos(Dot(A,B)/Length(A)/Length(B));}
double angle(Point v) {return atan2(v.y,v.x);}
double Cross(Point A,Point B) {return A.x*B.y-A.y*B.x;} Point Rotate(Point A,double rad)
{
return Point(A.x*cos(rad)-A.y*sin(rad),A.x*sin(rad)+A.y*cos(rad));
} Point GetLineIntersection(Point p,Point v,Point q,Point w)
{
Point u=p-q;
double t=Cross(w,u)/Cross(v,w);
return p+v*t;
} Point getD(Point A,Point B,Point C)
{
Point v1=C-B;
double a1=Angle(A-B,v1);
v1=Rotate(v1,a1/3); Point v2=B-C;
double a2=Angle(A-C,v2);
v2=Rotate(v2,-a2/3); return GetLineIntersection(B,v1,C,v2);
} void read(Point &a)
{
scanf("%lf %lf",&a.x,&a.y);
}
int main()
{
int cas;
scanf("%d",&cas);
while(cas--)
{
Point a,b,c,d,e,f;
read(a);
read(b);
read(c);
d=getD(a,b,c);
e=getD(b,c,a);
f=getD(c,a,b);
printf("%.6f %.6f %.6f %.6f %.6f %.6f\n",d.x,d.y,e.x,e.y,f.x,f.y);
}
return 0;
}
UVA 11178 Morley's Theorem 计算几何模板的更多相关文章
- UVA 11178 Morley's Theorem (计算几何)
题目链接 lrj训练指南 P259 //==================================================================== Point getP( ...
- 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(几何)
Morley's Theorem [题目链接]Morley's Theorem [题目类型]几何 &题解: 蓝书P259 简单的几何模拟,但要熟练的应用模板,还有注意模板的适用范围和传参不要传 ...
- 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=8&page=show_problem&p ...
- UVA 11178 Morley's Theorem(旋转+直线交点)
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18543 [思路] 旋转+直线交点 第一个计算几何题,照着书上代码打 ...
- Uva 11178 Morley's Theorem 向量旋转+求直线交点
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=9 题意: Morlery定理是这样的:作三角形ABC每个 ...
- UVa 11178 Morley's Theorem (几何问题)
题意:给定三角形的三个点,让你求它每个角的三等分线所交的顶点. 析:根据自己的以前的数学知识,应该很容易想到思想,比如D点,就是应该求直线BD和CD的交点, 以前还得自己算,现在计算机帮你算,更方便, ...
随机推荐
- Mongo数据库备份
安全访问状态下 手动在线备份: mongodump -h 127.0.0.1:27017 -u=username -p=123456 -d dbname -o /home/backups 手动恢复: ...
- 双元素非递增(容斥)--Number Of Permutations Educational Codeforces Round 71 (Rated for Div. 2)
题意:https://codeforc.es/contest/1207/problem/D n个元素,每个元素有a.b两个属性,问你n个元素的a序列和b序列有多少种排序方法使他们不同时非递减(不同时g ...
- 从入门到自闭之Python字典如何使用
字典: 定义:dict dict = {"key":"value"} -- 键值对 作用:存储大量数据,数据和数据起到关联作用 所有的操作都是通过键来完成 键: ...
- go build命令详解
原文地址讲解:https://blog.csdn.net/zl1zl2zl3/article/details/83374131
- redis 学习(14)-- HyperLogLog
HyperLogLog 什么是 HyperLogLog HyperLogLog 是基于 HyperLogLog 算法的一种数据结构,该算法可以在极小空间完成独立数量统计. 在本质上还是字符串类型. 重 ...
- 剑指offer-左旋转字符串-知识迁移能力-python
题目描述汇编语言中有一种移位指令叫做循环左移(ROL),现在有个简单的任务,就是用字符串模拟这个指令的运算结果.对于一个给定的字符序列S,请你把其循环左移K位后的序列输出.例如,字符序列S=”abcX ...
- JS基础_字面量和变量
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- luogu P3826 [NOI2017]蔬菜
luogu 那个第一次购买有\(s_i\)奖励,可以看成是多一种蔬菜\(i+n\),权值为\(w_i+s_i\),每天减少量\(x\)为0个,保质期\(\lceil\frac{c_i}{x_i}\rc ...
- java 关于数字取小数点后两位出现整数0没有的问题
最近再项目中对取到的一系列带很长小数的数字,展现时要求去小数点后两位显示就可以了 开始我是以下写法: double a = 0.1234455; DecimalFormat decimalForm ...
- calc,support,media各自的含义及用法
@support:用于检测浏览器是否支持CSS某个属性,即条件判断,如果支持某个属性,可以写一套样式,如果不支持某属性,提供另一套样式作为替补. calc():用于计算动态函数值,支持“+”,“-”, ...