题目链接

题意:给出A,B, C点坐标求D,E,F坐标,其中每个角都被均等分成三份  

求出 ABC的角a, 由 BC 逆时针旋转 a/3 得到BD,然后 求出 ACB 的角a2, 然后 由 BC顺时针 旋转 a2 / 3得到 DC,然后就交点

 #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
struct Point
{
double x, y;
};
typedef Point Vector;
Vector operator + (Vector A, Vector B)
{
Vector C;
C.x = A.x + B.x;
C.y = A.y + B.y;
return C;
}
Vector operator - (Vector A, Vector B)
{
Vector C;
C.x = A.x - B.x;
C.y = A.y - B.y;
return C;
}
Vector operator *(Vector A, double b)
{
Vector C;
C.x = A.x * b;
C.y = A.y * b;
return C;
}
Point read_point()
{
Point temp;
scanf("%lf%lf", &temp.x, &temp.y);
return temp;
}
double Dot(Vector A, Vector B)
{
return A.x * B.x + A.y * B.y;
}
double Length(Vector A)
{
return sqrt(Dot(A, A));
}
double Angle(Vector A, Vector B)
{
return acos(Dot(A, B) / Length(A) / Length(B));
}
Vector Rotate(Vector A, double rad)
{
Vector C;
C.x = A.x * cos(rad) - A.y * sin(rad);
C.y = A.x * sin(rad) + A.y * cos(rad);
return C;
}
double Cross(Vector A, Vector B)
{
return A.x * B.y - A.y * B.x;
}
Point GetLineIntersection(Point P, Vector v, Point Q, Vector w)
{
Vector u = P - Q;
double t = Cross(w, u) / Cross(v, w);
return P + v * t;
}
Point getD(Point A, Point B, Point C)
{
Vector v1 = C - B;
double a1 = Angle(A - B, v1);
v1 = Rotate(v1, a1 / ); Vector v2 = B - C;
double a2 = Angle(A - C, v2);
v2 = Rotate(v2, -a2 / ); return GetLineIntersection(B, v1, C, v2); }
int main()
{
int T;
Point A, B, C, D, E, F;
scanf("%d", &T);
while (T--)
{
A = read_point();
B = read_point();
C = read_point();
D = getD(A, B, C);
E = getD(B, C, A);
F = getD(C, A, B); printf("%.6lf %.6lf %.6lf %.6lf %.6lf %.6lf\n", D.x, D.y, E.x, E.y, F.x, F.y); }
return ;
}

UVA11178 Morley's Theorem(基础模板)的更多相关文章

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

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

  2. UVA11178 Morley's Theorem

    题意 PDF 分析 就按题意模拟即可,注意到对称性,只需要知道如何求其中一个. 注意A.B.C按逆时针排列,利用这个性质可以避免旋转时分类讨论. 时间复杂度\(O(T)\) 代码 #include&l ...

  3. [Uva11178]Morley's Theorem(计算几何)

    Description 题目链接 Solution 计算几何入门题 只要求出三角形DEF的一个点就能推出其他两个点 把一条边往内旋转a/3度得到一条射线,再做一条交点就是了 Code #include ...

  4. UVA 11178 Morley's Theorem 计算几何模板

    题意:训练指南259页 #include <iostream> #include <cstdio> #include <cstring> #include < ...

  5. uva 11178 - Morley's Theorem

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

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

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

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

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

  8. new 经典基础模板总结

    NOIP-NOI-ZJOI基础模板总结 目录 C++语言和STL库操作 重载运算符操作 /* 重载运算符 格式 如重载小于号 这里是以x递减为第一关键字比较,y递减为第二关键字比较 */ bool o ...

  9. Bootstrap 4/3 页面基础模板 与 兼容旧版本浏览器

    Bootstrap 3 与 4 差别很大,目录文件结构.所引入的内容也不同,这里说说一下 Bootstrap 引入的文件.网页模板和兼容性问题.本网站刚刚搭建好,正好发一下文章原来测试网站. Boot ...

随机推荐

  1. C# Image Resizer

    This program is used to resize images. using System; using System.Windows.Forms; using System.Drawin ...

  2. windows 内部预览版与迅雷极速版不配合

    为了体验bash on ubuntu安装的预览版本,结果原来的迅雷极速版本无法成功下载文件,总是在最后一刻报错退出. 解决方法是: 下载安装迅雷9 哈哈哈哈,新版迅雷挺不错的,运行良好. ctrl^v ...

  3. linux基础-第六单元 用户、群组和权限

    用户及passwd文件 /etc/passwd文件的功能 /etc/passwd文件每个字段的具体含义 shadow文件 /etc/shadow文件的功能 /etc/shadow文件每个字段的具体含义 ...

  4. 【Alpha版本】冲刺阶段——Day 9

    我说的都队 031402304 陈燊 031402342 许玲玲 031402337 胡心颖 03140241 王婷婷 031402203 陈齐民 031402209 黄伟炜 031402233 郑扬 ...

  5. XML的总结学习

    XML 指可扩展标记语言(eXtensible Markup Language). XML 被设计用来传输和存储数据. HTML 被设计用来显示数据.  (一切都是为了数据:采集.整理.存储.传输.显 ...

  6. Ubuntu14.04安装MySql

    我们要确保Ubuntu14.04的服务器是可以上网的,这里我就不操作,这个比较简单.由于我的服务器是用Cobbler部署的,所以要更改源. # vi /etc/apt/source.list   我这 ...

  7. 区间DP lightoj 1422

    t个样例 n  n个数字 从 1->n  穿衣服  脱了就不能再用 ,可以套 问最少几件衣服 #include<stdio.h> #include<string.h> # ...

  8. git初体验(七)多账户的使用

    多github帐号的SSH key切换 我有两个github帐号,一个是个人所用,一个是为公司项目所用.如果是单用户(single-user),很方便,默认拿id_rsa与你的github服务器的公钥 ...

  9. MyEclipse项目上有个感叹号

    如图: 然后把有叉的选项移除就可以了

  10. bootstrap的基本模板

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...