题意:训练指南259页

#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 计算几何模板的更多相关文章

  1. UVA 11178 Morley's Theorem (计算几何)

    题目链接 lrj训练指南 P259 //==================================================================== Point getP( ...

  2. uva 11178 - Morley's Theorem

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

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

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

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

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

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

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

  6. UVA 11178 - Morley's Theorem 向量

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

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

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

  8. Uva 11178 Morley's Theorem 向量旋转+求直线交点

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=9 题意: Morlery定理是这样的:作三角形ABC每个 ...

  9. UVa 11178 Morley's Theorem (几何问题)

    题意:给定三角形的三个点,让你求它每个角的三等分线所交的顶点. 析:根据自己的以前的数学知识,应该很容易想到思想,比如D点,就是应该求直线BD和CD的交点, 以前还得自己算,现在计算机帮你算,更方便, ...

随机推荐

  1. [转帖]处理器结构--PipeLine&SuperScalar

    处理器结构--PipeLine&SuperScalar https://www.jianshu.com/p/36c80a15a226  0.1 2018.06.12 16:12* 字数 148 ...

  2. 纯前端表格控件SpreadJS以专注业务、提升效率赢得用户与市场

    提起华为2012实验室,你可能有点陌生. 但你一定还对前段时间华为的那封<海思总裁致员工的一封信>记忆犹新,就在那篇饱含深情的信中,我们知道了华为为确保公司大部分产品的战略安全和连续供应, ...

  3. 微信小程序打开地图选择位置

    wx.getLocation({ type: 'wgs84', success(res) { const latitude = res.latitude const longitude = res.l ...

  4. 在字符串中找出第一个只出现一次的字符,Python实现

    要求: 1. 不能依赖库函数直接实现此功能,需使用基础的数据结构实现 2. 时间复杂度 O(n) 思路: 1. 用字典存储每个字符在字符串中出现的次数 2. 列表是有序的,用来存储字符的出现先后 3. ...

  5. mysql连接数据库时报2003错误怎么解决

    mysql 2003是连接错误,连不上服务器. 你目前可以如下方法:进入控制面板->服务管理(我的是管理工具),->服务,然后找到Mysql服务,右键修改属性,改为自启动,以后再重启就没有 ...

  6. The Digits String

    https://ac.nowcoder.com/acm/contest/338/L 题解: 当n==1时,0-9填上的话,对4取余,分别是余数为0的3个,1的3个,2的2个,3的2个: 当n==2时, ...

  7. 使用mybatis插件自动生成代码以及问题处理

    1.pom.xml中加入依赖插件 <!-- mybatis generator 自动生成代码插件 --> <plugin> <groupId>org.mybatis ...

  8. 02 Linux常用基本命令(二)

    1.Linux的文件系统格式 1.以 / 为根目录,成树状结构分布 2.查看根目录下有什么 ls / 3./下有超级用户root的家目录(root),还有普通用户的家目录(/home) 4.常用文件夹 ...

  9. 【Lucene】小谈lucene的BooleanQuery查询对象

    BooleanQuery用于逻辑查询,即所谓的组合查询,具体的逻辑关系如下: 一个具体的使用测试,如下:

  10. Pornhub Web 开发者访谈

    原文:Interview with a Pornhub Web Developer 译者:neal1991 welcome to star my articles-translator, provid ...