Problem D 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 six integers . 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

 

题目大意:给一个三角形的三个顶点求1/3角平分线的交点。

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std; 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 -(Vector A,Vector 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);
}
const double eps=1e-; int dcmp(double x)
{
if(fabs(x)<eps) return ;
else 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;}//叉积 Vector Rotate(Vector A,double 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 read_point()
{
Point A;
scanf("%lf %lf",&A.x,&A.y);
return A;
} Point getpoint(Point A,Point B,Point C)
{
Vector v1,v2;
double a1,a2;
v1=C-B;
v2=B-C;
a1=Angle(A-B,C-B)/;
a2=Angle(A-C,B-C)/;
v1=Rotate(v1,a1);
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=getpoint(A,B,C);
E=getpoint(B,C,A);
F=getpoint(C,A,B);
printf("%.6lf %.6lf %.6lf %.6lf %.6lf %.6lf\n",D.x,D.y,E.x,E.y,F.x,F.y);
}
return ;
}

uva 11178二维几何(点与直线、点积叉积)的更多相关文章

  1. UVa 12304 (6个二维几何问题合集) 2D Geometry 110 in 1!

    这个题能1A纯属运气,要是WA掉,可真不知道该怎么去调了. 题意: 这是完全独立的6个子问题.代码中是根据字符串的长度来区分问题编号的. 给出三角形三点坐标,求外接圆圆心和半径. 给出三角形三点坐标, ...

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

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

  3. Codeforces#514D(三分,简单二维几何)

    #include<bits/stdc++.h>using namespace std;const double eps=1e-8;int n; struct node{    double ...

  4. Foj 2148 二维几何(点是否在三角形内)

    题目大意:给n个坐标(不存在三点共线的点),求能够组成多少个凸四边形. #include<iostream> #include<cstdio> #include<cmat ...

  5. UVA 11019 二维匹配 AC自动机

    这个题目要求在一个大矩阵里面匹配一个小矩阵,是AC自动机的灵活应用 思路是逐行按普通AC自动机匹配,用过counts[i][j]记录一下T字符矩阵以i行j列为开头的与P等大的矩阵区域 有多少行已经匹配 ...

  6. UVA 10465 Homer Simpson(全然背包: 二维目标条件)

    UVA 10465 Homer Simpson(全然背包: 二维目标条件) http://uva.onlinejudge.org/index.php? option=com_onlinejudge&a ...

  7. UVA 10306 e-Coins(全然背包: 二维限制条件)

    UVA 10306 e-Coins(全然背包: 二维限制条件) option=com_onlinejudge&Itemid=8&page=show_problem&proble ...

  8. UVA 11297 线段树套线段树(二维线段树)

    题目大意: 就是在二维的空间内进行单个的修改,或者进行整块矩形区域的最大最小值查询 二维线段树树,要注意的是第一维上不是叶子形成的第二维线段树和叶子形成的第二维线段树要  不同的处理方式,非叶子形成的 ...

  9. UVA 11019 Matrix Matcher(二维hash + 尺取)题解

    题意:在n*m方格中找有几个x*y矩阵. 思路:二维hash,总体思路和一维差不太多,先把每行hash,变成一维的数组,再对这个一维数组hash变成二维hash.之前还在想怎么快速把一个矩阵的hash ...

随机推荐

  1. COGS 2280. [HZOI 2015]树白黑

    ★★   输入文件:B_Tree.in   输出文件:B_Tree.out   简单对比时间限制:2 s   内存限制:512 MB [题目描述] 给定一棵有根树,树根为1,一开始这棵树所有节点均为白 ...

  2. 聊聊C语言和ABAP

    这个公众号之前的文章,分享的都是Jerry和SAP成都研究院的同事在工作中学到的一些知识和感受.而今天这篇文章,写作的由来是因为最近我又参与了SAP成都数字创新空间应聘者的面试,和一些朋友聊了一些关于 ...

  3. Windows Dos命令下查看端口号,杀死端口

    PS:本文以 Redis 默认端口 6379 为例   1,首先查询该端口的 pid,使用命令 [netstat -ano | findstr 端口号]   F:\Program Files\Redi ...

  4. spring boot 下 dataTable|pagehelper 组合进行分页 筛选 排序

    1)Js 需提前引用 jquery.dataTables $(function () { //提示信息 初始化设置 一般不需要改 var lang = { "sProcessing" ...

  5. Arch Linux 天坑

    https://wiki.archlinux.org/index.php/Samba_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87) samba  gui客户端 smb4 ...

  6. WPF显示尺寸与设备无关问题

    WPF单位 WPF窗口以及其中的所有元素都是用与设备无关的单位进行度量.一个与设备无关的单位被定义为1/96英寸.WPF程序统一用下面一个公式来定义物理单位尺寸: [ 物理单位尺寸(像素)] = [ ...

  7. java第九次作业:第九章例题3个

    作业1: 例题9.1 制作圆类,根据圆的半径求出周长及面积 package com.swift; //抽象的方法构成类,把属性和方法进行封装 public class Circle { // 两个方面 ...

  8. CS193p Lecture 7 - Views, Gestures

    Views 如何绘制自定义图像 Gestures 如何处理用户手势操作 Views 1.它是基本的构造块,代表屏幕上一块矩形区域,定义了一个坐标空间,在此空间中可以绘制,可以添加触控事件: 2.它是分 ...

  9. ios 检查内存泄露

    简介 在IPhone程式开发中,记忆体泄漏(内存泄漏)是个很容易发生的情况,因为IPhone必须自行作记忆体管理.现在的开发者,大多习惯用的.NET或Java的等有垃圾回收机制的开发语言来作开发,因此 ...

  10. vue父子传值的具体应用

    最近我负责的项目已经迭代到第四版了,我作为一个没啥经验的小菜鸟也成长了很多. 在这一版开发开始之前,我老大就要求我在开发过程中尽量实现组件化,因此,我也遇到了很多问题,但基本都解决了,所以趁周末把这些 ...