Morley's Theorem
题解:
计算几何基本操作
注意叉积的时候字母写的顺序
代码:
#include <bits/stdc++.h>
using namespace std;
#define rint register int
#define IL inline
#define rep(i,h,t) for (int i=h;i<=t;i++)
#define dep(i,t,h) for (int i=t;i>=h;i--)
const double eps=1e-;
struct Point
{
double x,y;
Point(double x1,double y1) {x=x1,y=y1;}
Point(){};
Point operator +(const Point b) const
{
return Point(x+b.x,y+b.y);
}
Point operator -(const Point b) const
{
return Point(x-b.x,y-b.y);
}
double operator *(const Point b) const
{
return x*b.x+y*b.y;
}
double operator ^(const Point b) const
{
return x*b.y-y*b.x;
}
Point operator *(double k)
{
return Point(x*k,y*k);
}
Point operator /(double k)
{
return Point(x/k,y/k);
}
bool operator ==(Point b)
{
return b.x==x&&b.y==y?:;
}
};
struct Line
{
Point x,y;
Line() {};
Line(Point x1,Point y1){x=x1,y=y1;};
};
double lenth(Point x)
{
return sqrt(x.x*x.x+x.y*x.y);
}
double angle(Point x,Point y)
{
return acos(x*y/lenth(x)/lenth(y));
}
int dcmp(double x)
{
if (x<-eps) return(-);
else if (x>eps) return();
else return();
}
Point rotate(Point x,double r)
{
return Point(x.x*cos(r)-x.y*sin(r),x.x*sin(r)+x.y*cos(r));
}
Point gtp(Line x,Line y)
{
Point v1=x.y-x.x; Point v2=y.y-y.x;
double k=((x.x^v1)-(y.x^v1))/(v2^v1);
return y.x+v2*k;
}
double distance(Point x,Line y)
{
Point p1=x-y.x,p2=y.y-y.x;
return fabs((p1^p2)/lenth(p2));
}
Point get(Point a,Point b,Point c)
{
Point v1,v2;
double r1=angle(a-b,c-b);
v1=rotate(c-b,r1/); v1=v1+b;
double r2=angle(a-c,b-c);
v2=rotate(b-c,-r2/); v2=v2+c;
return gtp(Line(b,v1),Line(c,v2));
}
int main()
{
freopen("1.in","r",stdin);
freopen("1.out","w",stdout);
ios::sync_with_stdio(false);
int T;
cin>>T;
while (T--)
{
int a1,a2,a3,b1,b2,b3;
cin>>a1>>b1>>a2>>b2>>a3>>b3;
Point p1,p2,p3,a,b,c;
p1=Point(a1,b1); p2=Point(a2,b2); p3=Point(a3,b3);
a=get(p1,p2,p3); b=get(p2,p3,p1); c=get(p3,p1,p2);
printf("%.6lf %.6lf %.6lf %.6lf %.6lf %.6lf\n",
a.x,a.y,b.x,b.y,c.x,c.y);
}
return ;
}
Morley's Theorem的更多相关文章
- uva 11178 - Morley's Theorem
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...
- uva11178 Morley’s Theorem(求三角形的角三分线围成三角形的点)
Morley’s Theorem Input: Standard Input Output: Standard Output Morley’s theorem states that that the ...
- 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 (坐标旋转)
题目链接:UVA 11178 Description Input Output Sample Input Sample Output Solution 题意 \(Morley's\ theorem\) ...
- UVa 11178 (简单练习) Morley's Theorem
题意: Morley定理:任意三角形中,每个角的三等分线,相交出来的三个点构成一个正三角形. 不过这和题目关系不大,题目所求是正三角形的三个点的坐标,保留6位小数. 分析: 由于对称性,求出D点,EF ...
- Morley's Theorem (计算几何基础+向量点积、叉积、旋转、夹角等+两直线的交点)
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...
- UVA 11178 - Morley's Theorem 向量
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...
- UVA11178 Morley's Theorem(基础模板)
题目链接 题意:给出A,B, C点坐标求D,E,F坐标,其中每个角都被均等分成三份 求出 ABC的角a, 由 BC 逆时针旋转 a/3 得到BD,然后 求出 ACB 的角a2, 然后 由 BC顺时 ...
- UVA 11178 Morley's Theorem(旋转+直线交点)
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18543 [思路] 旋转+直线交点 第一个计算几何题,照着书上代码打 ...
随机推荐
- <pre>标签的基本样式设置
断行 在html中,换行符无法在一般标签内作为布局控制显示,包括xml实体 和 均表现为white-space,仅用于断字[1]. 一般情形下,可使用<br>标签断行:但需要从原始xml文 ...
- RS485 通信接收时丢失0x11等数据
RS485通信接收方,丢弃掉了值为 0x11 的数据. 怀疑 0x11 被转义,没有按照原始数据接收, 查看ASCII码对应表 0x11 代表 “本文结束”, 因此丢弃是有可能的. 要想接收原始数据而 ...
- MySQL数据库的一些方法使用
substring_index(windSpeed,)/3.6 as windSpeed 可将 .8公里.0m/s 进行拆分 嵌套使用replace方法 replace( replace( repla ...
- SSL For Free 申请免费https SSL 凭证
打开 SSL For Free网站(https://www.sslforfree.com) ,在输入框中填入你要申请 Let’s Encrypt 凭证的网域名称,可以用空白来分隔不同的网址,例如[su ...
- chan array初始化
package main import "fmt" func run() { chann[0] <- 1 } var chann = make([]chan int, 2) ...
- python字符串str和字节数组bytes相互转化
1 引言 后续待补充 2 代码 b = b"Hello, world!" # bytes s = "Hello, world!" # string print( ...
- 安装snap及snap常安装软件
文章链接:https://blog.csdn.net/laomd/article/details/80710451 一.snap简介 什么是snap,snap是一种全新的软件包管理方式,它类似一个容器 ...
- oracle数据库链路和同义词
Oracle数据库链路的建立和使用 先来一个例子: --创建数据库链路create public database link xaffdblink connect to zdcl identi ...
- PHP中$_POST和$_GET的用法
post和get是指:页面提交的两种方式get:参数都体现在url上,可以用于翻页,简单查询,get只能接收2M以下的内容,所以有局限性,另外由于内容是可见的,安全性就下降了,post:用于页面表单 ...
- java学习——异常处理
类 Throwable类 Java 语言中所有错误或异常的超类.只有当对象是此类(或其子类之一)的实例时,才能通过 Java 虚拟机或者 Java throw语句抛出.类似地,只有此类 ...