题解:

计算几何基本操作

注意叉积的时候字母写的顺序

代码:

#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的更多相关文章

  1. uva 11178 - Morley's Theorem

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

  2. uva11178 Morley’s Theorem(求三角形的角三分线围成三角形的点)

    Morley’s Theorem Input: Standard Input Output: Standard Output Morley’s theorem states that that the ...

  3. UVA 11178 Morley's Theorem(几何)

    Morley's Theorem [题目链接]Morley's Theorem [题目类型]几何 &题解: 蓝书P259 简单的几何模拟,但要熟练的应用模板,还有注意模板的适用范围和传参不要传 ...

  4. UVa 11178:Morley’s Theorem(两射线交点)

    Problem DMorley’s TheoremInput: Standard Input Output: Standard Output Morley’s theorem states that ...

  5. UVA 11178 Morley's Theorem (坐标旋转)

    题目链接:UVA 11178 Description Input Output Sample Input Sample Output Solution 题意 \(Morley's\ theorem\) ...

  6. UVa 11178 (简单练习) Morley's Theorem

    题意: Morley定理:任意三角形中,每个角的三等分线,相交出来的三个点构成一个正三角形. 不过这和题目关系不大,题目所求是正三角形的三个点的坐标,保留6位小数. 分析: 由于对称性,求出D点,EF ...

  7. Morley's Theorem (计算几何基础+向量点积、叉积、旋转、夹角等+两直线的交点)

    题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...

  8. UVA 11178 - Morley's Theorem 向量

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

  9. UVA11178 Morley's Theorem(基础模板)

    题目链接 题意:给出A,B, C点坐标求D,E,F坐标,其中每个角都被均等分成三份   求出 ABC的角a, 由 BC 逆时针旋转 a/3 得到BD,然后 求出 ACB 的角a2, 然后 由 BC顺时 ...

  10. UVA 11178 Morley's Theorem(旋转+直线交点)

    题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18543 [思路] 旋转+直线交点 第一个计算几何题,照着书上代码打 ...

随机推荐

  1. 设计模式C++学习笔记之十(Builder建造者模式)

      建造者模式,将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示.一段晦涩难懂的文字,实现创建不同表示的方法就是给创建的过程传入创建的参数.详细的还是看代码吧. 10.1.解释 ...

  2. VB中的冒号——bug

    关于VB中的冒号,给许多人的印象都是:“一行可书写几句语句”.这么说是对的,但是有一种情况是不对的,那就是在条件语句中.这也是做一个VB项目升级的时候遇到,因为这个问题我查了好长时间程序,一直在找VB ...

  3. host, nslookup, dig、whois

    一.host命令:DNS 查找使用程序 选项与参数: -a :代表列出该主机所有的相关信息,包括 IP.TTL 与除错讯息等等 -l :若后面接的那个 domain 设定允许 allow-transf ...

  4. 在VS解决方案资源管理器中自动定位当前编辑中的文件

    依次点击 [工具]- [选项] - [项目和解决方案]-[常规]- 勾选[在解决方案资源管理器中跟踪活动项]

  5. python操作三大主流数据库(7)python操作mongodb数据库①mongodb的安装和简单使用

    python操作mongodb数据库①mongodb的安装和简单使用 参考文档:中文版:http://www.mongoing.com/docs/crud.html英文版:https://docs.m ...

  6. Windows10下Django虚拟环境配置和简单入门实例

    环境win10家庭版64位 + python 3.5 + Django 1.8.2 1.创建virtualenv目录 开始/运行/cmd回车,进入cmd窗口,到自己指定的目录下创建virtualenv ...

  7. 软件包.deb的安装及卸载------dpkg

    文章链接:https://blog.csdn.net/qq_36764147/article/details/81332606 删除带有rc的软件包:https://blog.csdn.net/chr ...

  8. Protobuf3 语法指南

    目录 [−] 定义一个消息类型 指定字段类型 分配标识号 指定字段规则 添加更多消息类型 添加注释 保留标识符(Reserved) 从.proto文件生成了什么? 标量数值类型 默认值 枚举 使用其他 ...

  9. Codeforces 438E The Child and Binary Tree [DP,生成函数,NTT]

    洛谷 Codeforces 思路 看到计数和\(998244353\),可以感觉到这是一个DP+生成函数+NTT的题. 设\(s_i\)表示\(i\)是否在集合中,\(A\)为\(s\)的生成函数,即 ...

  10. idea Unable to open debugger port (127.0.0.1:58006) Address already in use: JVM_Bind 的解决办法

    报错说端口58006 被占用了,于是去修改端口 重新dubug 发现换个端口号还是不行,同样的错误.有时候你把idea关闭重新打开依旧不起作用.最暴力的办法就是重启电脑... 问题解决: 查看使用中的 ...