题目链接

题意:给出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. 使用axes函数在matlab绘图中实现图中图的绘制

    使用axes函数在matlab绘图中实现图中图的绘制 有时为了对细节进行详细说明,需要在一个较大坐标轴上绘制一个小图来对局部进行放大以阐述结果. 这可以通过调用axes函数实现. 下面通过绘制 y=1 ...

  2. Android下的数据储存方式( 二)

    在上一篇文章中我们介绍了SharedPreferences的使用方法. 今天我们继续介绍另一种储存数据的方式:使用内部储存和外部储存 每一个Android设备都拥有两个数据储存区域:外部储存和外部储存 ...

  3. 1118sync_binlog innodb_flush_log_at_trx_commit 浅析

    转自 http://blog.itpub.net/22664653/viewspace-1063134/  innodb_flush_log_at_trx_commit和sync_binlog 两个参 ...

  4. 1021mysql 全外连接

    mysql 不支持全外连接,那么使用union all进行替换 -- 其他数据库 SELECT * FROM aa aFULL OUTER JOIN bb b ON a.col1=b.col1AND ...

  5. Javascript写俄罗斯方块游戏

    俄罗斯方块这个游戏也做了移动端的兼容, 这个游戏难点是怎么翻转方块, 自己实现的方式是把方块放到一个二维数组, 然后逆时针旋转二维数组. 也有别的方法,比如直接用一个全局变量代表一个方向, 翻转的时候 ...

  6. NHibernate中session.update()及session.merge()的区别

    今天的工作中遇到一个奇怪的问题,如下: "a different object with the same identifier value was already associated w ...

  7. poi-处理excel的单元格日期数据

    poi处理excel时,当excel没有明确指明是哪个类型的数据时,poi很可能处理单元格的日期数据时就有可能是一串数字.而使用java程序基本无法转换 以下为对poi处理日期情况一些方面的处理(不是 ...

  8. C#-WebForm-★ 制作图片验证码 ★

    在前台放在如下四个控件 <div> <asp:TextBox ID="TextBox1" runat="server"></asp ...

  9. MySQL 1045登录失败

    当你登录MySQL数据库出现:Error 1045错误时(如下图),就表明你输入的用户名或密码错误被拒绝访问了,最简单的解决方法就是将MySQL数据库卸载然后重装,但这样的缺点就是就以前的数据库中的信 ...

  10. jquery $.each 和for怎么跳出循环终止本次循环

    1.for循环中我们使用continue:终止本次循环计入下一个循环,使用break终止整个循环. 2.而在jquery中 $.each则对应的使用return true 和return false. ...