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 [思路] 旋转+直线交点 第一个计算几何题,照着书上代码打 ...
随机推荐
- HTTP协议06-报文首部
HTTP报文格式 HTTP协议的请求和响应报文中必定包含HTTP首部.首部内容为客户端和服务器分别处理请求和响应提供所需要的信息. 1)HTTP请求报文 在请求中,HTTP报文由方法.URI.HT ...
- 题解-AtCoder-agc006C Rabbit Exercise
Problem AtCoder & bzoj 题意:数轴上有\(n\)个点(初始坐标均为整数),编号为\(1\)~\(n\).给出\(m\)个操作. 每个操作会选定点\(a\),然后随机在点\ ...
- document.execCommand()的用法小记
项目中遇到金额输入框限制只能输入数字,输入特殊字符或者字母汉字时间隔不到1秒内容就会自动清空.跟正则纠缠多年的我初次见到,很是神奇-.- 代码实现: <input type="text ...
- 034_nginx报错总结
一.nginx: [emerg] "client_header_timeout" directive is not allowed here in /opt/nginx/conf/ ...
- c中perror函数
写代码这么久,竟然很少用到perror函数,忘记了其强大的功能. 所在头文件: #include<stdio.h> 函数定义: void perror(const char *str); ...
- Solidworks设计电路外形导入AltiumDesigner
将实际设计好的三维电路图的底板(单个零件模式下)轮廓另存为dwf或者dwg 这时候会出现一个选项框,需要进行一些设置 单位选择mm,这个按照自己的需求选择单位 单位映射选择为1mm,也就是1:1的比例 ...
- CentOS7安装和配置MySQL
1. 下载MySQL Yum Repository http://dev.mysql.com/downloads/repo/yum/ 2. 本地安装MySQL Yum Repository s ...
- iOS NSArray 的count方法返回的是无符号整形!
){ return cell; } 这样写是错误的!!!当数组为空时,由于count方法返回的是无符号整形,没有负数,self.requests.count -1是一个非常大的正数! 正确写法: &g ...
- 通过dd命令显示硬盘的读写性能
测试vdb硬盘的读写速度 1.分区格式化挂载vdb硬盘 2.新建写入文件2 3.测试:文件2中写入数据,设置块大小为100M,拷贝块个数为5 经过测试:测试效果一般count越高越准确,建议为300, ...
- 39)django-XSS 过滤
使用kingedit别人是可以输入script代码.这在后台是不允许script代码运行的. 这里主要使用beatifulSoup过滤 示例1 beatufulsoup4 from bs4 impor ...