Morley’s Theorem Input: Standard Input

Output: Standard Output

Morley’s theorem states that that the lines trisecting the angles of an arbitrary plane triangle meet at the vertices of an equilateral triangle. For example in the figure below the tri-sectors of angles A, B and C has intersected and created an equilateral triangle DEF.

Of course the theorem has various generalizations, in particular if all of the tri-sectors are intersected one obtains four other equilateral triangles. But in the original theorem only tri-sectors nearest to BC are allowed to intersect to get point D, tri-sectors nearest to CA are allowed to intersect point E and tri-sectors nearest to AB are intersected to get point F. Trisector like BD and CE are not allowed to intersect. So ultimately we get only one equilateral triangle DEF. Now your task is to find the Cartesian coordinates of D, E and F given the coordinates of A, B, and C.

Input

First line of the input file contains an integer N (0<N<5001) which denotes the number of test cases to follow. Each of the next lines contain sixintegers . This six integers actually indicates that the Cartesian coordinates of point A, B and C are  respectively. You can assume that the area of triangle ABC is not equal to zero,  and the points A, B and C are in counter clockwise order.

Output

For each line of input you should produce one line of output. This line contains six floating point numbers  separated by a single space. These six floating-point actually means that the Cartesian coordinates of D, E and F are  respectively. Errors less than   will be accepted.

Sample Input   Output for Sample Input

2
1 1 2 2 1 2
0 0 100 0 50 50

1.316987 1.816987 1.183013 1.683013 1.366025 1.633975

56.698730 25.000000 43.301270 25.000000 50.000000 13.397460

 

tijie:

tijie: 错的心酸。。。只需要求出两条直线求交点;

代码:

 #include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const double eps=1e-;
struct Point{
double x,y;
Point(double x=,double y=):x(x),y(y){}
};
typedef Point Vector;
Vector operator + (Vector A, Vector B) { return Vector(A.x + B.x, A.y + B.y); }
Vector operator - (Point A, Point B) { return Vector(A.x - B.x, A.y - B.y); }
Vector operator * (Vector A, double p) { return Vector(A.x * p, A.y * p); }
Vector operator / (Vector A, double p) { return Vector(A.x / p, A.y / p); }
bool operator < (const Point &a,const Point &b){
return a.x<b.x||(a.x==b.x&&a.y<b.y);//排序
}
int dcmp(double x){//
if(fabs(x)<eps)return ;
return x<?-:;
}
bool operator == (const Point &a,const Point &b){
return dcmp(a.x-b.x)==&&dcmp(a.y-b.y)==;
}
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)); } //两个向量的夹角
double Cross(Vector A, Vector B) { return A.x * B.y - A.y * B.x; } //叉乘
double Area(Point A, Point B, Point C) { return Cross(B - A, C - A); } //三个点组成的三角形的面积 Vector Rotate(Vector A, double rad) { //向量A逆时针旋转rad弧度后的坐标
return Vector(A.x * cos(rad) - A.y * sin(rad), A.x * sin(rad) + A.y * cos(rad));
} 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/);//少了ROTATE。。。。。。
Vector v2=B-C;
double a2=Angle(A-C,v2);
v2=Rotate(v2,-a2/);
//printf("%lf %lf %lf %lf %lf %lf\n",v1.x,v1.y,v2.x,v2.y,a1/3,a2/3);
return GetLineIntersection(B,v1,C,v2);
}
int main(){
int T;
Point a,b,c,d,e,f;
scanf("%d",&T);
while(T--){
scanf("%lf%lf%lf%lf%lf%lf",&a.x, &a.y, &b.x, &b.y, &c.x, &c.y);
d=getD(a,b,c);
e=getD(b,c,a);
f=getD(c,a,b);
printf("%lf %lf %lf %lf %lf %lf\n",d.x,d.y,e.x,e.y,f.x,f.y);
}
return ;
}

uva11178 Morley’s Theorem(求三角形的角三分线围成三角形的点)的更多相关文章

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

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

  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

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

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

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

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

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

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

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

  8. UVA 11178 - Morley's Theorem 向量

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

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

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

随机推荐

  1. C/C++存储区划分

    一. 在c中分为这几个存储区1.栈 - 由编译器自动分配释放2.堆 - 一般由程序员分配释放,若程序员不释放,程序结束时可能由OS回收3.全局区(静态区),全局变量和静态变量的存储是放在一块的,初始化 ...

  2. MySql每月增加一个分区以及查询所有分区

    create PROCEDURE Usp_Partition() BEGIN DECLARE _time datetime; DECLARE num int; DECLARE _p VARCHAR(2 ...

  3. HDU1257-最少拦截系统

    描述: 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来 ...

  4. AeroSpike 记录

    1.基本概念: namespace:类似关系型数据库中的schema,这个需要在配置文件中配置,可以指定存储引擎.存储大小.备份数.存活时间等 set:类似关系型数据库中的表 record:类似关系型 ...

  5. datatable,查询,排序,复制等操作

    DataTable排序,检索,合并详解 一.排序 获取DataTable的默认视图 对视图设置排序表达式 用排序后的视图导出的新DataTable替换就DataTable (Asc升序可省略,多列排序 ...

  6. crt连接vitualbox中centos虚拟机

    在virtalbox中安装了centos虚拟机后,在虚拟机中直接操作很是不方便,所以想用crt连接虚拟机, 1.打开virtualbox,设置-网络,网络连接2设置连接方式为“Bridged Adap ...

  7. codeforces 628F. Bear and Fair Set 网络流

    题目链接 F. Bear and Fair Set time limit per test 2 seconds memory limit per test 256 megabytes input st ...

  8. java集合分析(转载)

    参考文章:浅谈Java中的Set.List.Map的区别 Java 7 Collections详解 java中集合分为三类: Set(集) List(列表) Map(映射) Set和List继承自Co ...

  9. 帝国cms后台 不同栏目发布字段不同

    在同一数据表下的两个栏目,由于功能不同,也需要建立不同的字段,问题是建立完不同字段后,其数据表下的两个栏目都有发布字段.这里教大家,不同栏目下发布内容,不同字段.修改数据模型中 录入表单模板 代码.底 ...

  10. vs2012-vs2013编译出来的程序不能在xp上运行解决方法

    在链接标志中加入参数: /SUBSYSTEM:WINDOWS,"5.01" 在ide环境下: 项目属性-常规-平台工具集-Visual Studio 2013 - Windows ...