uva 11178
题意:根据A,B,C三点的位置确定D,E,F三个点的位置。
贴模板
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<memory.h>
#include<cstdlib>
#include<vector>
#define clc(a,b) memset(a,b,sizeof(a))
#define LL long long int
using namespace std;
const int N=;
const int inf=0x3f3f3f3f;
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/); 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--)
{
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 ;
}
uva 11178的更多相关文章
- UVA 11178 Morley's Theorem (坐标旋转)
题目链接:UVA 11178 Description Input Output Sample Input Sample Output Solution 题意 \(Morley's\ theorem\) ...
- uva 11178 - Morley's Theorem
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...
- Uva 11178 Morley's Theorem 向量旋转+求直线交点
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=9 题意: Morlery定理是这样的:作三角形ABC每个 ...
- UVA 11178 - Morley's Theorem 向量
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...
- UVA 11178 /// 向量旋转 两向量夹角
题目大意: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_proble ...
- UVa 11178 (简单练习) Morley's Theorem
题意: Morley定理:任意三角形中,每个角的三等分线,相交出来的三个点构成一个正三角形. 不过这和题目关系不大,题目所求是正三角形的三个点的坐标,保留6位小数. 分析: 由于对称性,求出D点,EF ...
- UVA 11178 Morley's Theorem(旋转+直线交点)
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18543 [思路] 旋转+直线交点 第一个计算几何题,照着书上代码打 ...
- uva 11178 Morley's Theorem(计算几何-点和直线)
Problem D Morley's Theorem Input: Standard Input Output: Standard Output Morley's theorem states tha ...
- UVa 11178计算几何 模板题
#include<cstdio> #include<cstring> #include<cmath> #include<iostream> #inclu ...
随机推荐
- [转载]再次谈谈easyui datagrid 的数据加载
这篇文章只谈jQuery easyui datagrid 的数据加载,因为这也是大家谈论最多的内容.其实easyui datagrid加载数据只有两种方式:一种是ajax加载目标url返回的json数 ...
- 【更新链接】U盘启动制作工具(UDTOOL) v3.0.2014.0427
[校验值] 文件: UDTOOLV3_Setup.exe大小: 525 MB版本: 3.0.2014.0427时间: 2014年4月27日MD5: 2E5187B7D9081E8A69B4DC45C8 ...
- hdu 1087
动规 d[i]记录以第 i 个数结尾的最大值 #include <cstdio> #include <algorithm> #include <cstring> ...
- CodeForces 300A Array
http://codeforces.com/problemset/problem/300/A 题意 :给你n个数字,让你分成3组,第一组各个数之积要小于0,第二组要大于0,第三组要等于0,符合要求的答 ...
- html10个特效(转载)
http://www.html5tricks.com/10-html5-jquery-image-animatin.html 现在网页上的图片已经不再是10几年前那种低像素的静态图片了,有了HTML5 ...
- codeforces #313 div1 C
同BZOJ 3782 上学路线 QAQ 还比那个简单一点 把坐标(1,1)-(n,m)平移成(0,0)-(n-1,m-1) 设dp[i]表示从(1,1)出发第一次经过障碍且到达第i个障碍的方案数 首先 ...
- [topcoder]BadNeighbors
http://community.topcoder.com/stat?c=problem_statement&pm=2402&rd=5009 动态规划题.对于圈状的题目有了点感觉. 题 ...
- 选择排序的MPI实现
#include "stdafx.h" #include "mpi.h" #include <stdio.h> #include <math. ...
- SQLite入门与分析(一)---简介
写在前面:出于项目的需要,最近打算对SQLite的内核进行一个完整的剖析,在此希望和对SQLite有兴趣的一起交流.我知道,这是一个漫长的过程,就像曾经去读Linux内核一样,这个过程也将是辛苦的,但 ...
- PHP 简单的加密解密算法
<?php /** * * @创建时间:2015-3-12 下午2:07:33 * @作者:YuMing * @描述:异或加密解密类 */ class Yihuo extends CI_Cont ...