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 ...
随机推荐
- 使用 Spark 进行微服务的实时性能分析
[编者按]当开发者从微服务架构获得敏捷时,观测整个系统的运行情况成为最大的痛点.在本文,IBM Research 展示了如何用 Spark 对微服务性能进行分析和统计,由 OneAPM 工程师编译整理 ...
- 利用VS2005进行dump文件调试
前言:利用drwtsn32或NTSD进行程序崩溃处理,都可以生成可用于调试的dmp格式文件.使用VS2005打开生成的DMP文件,能很方便的找出BUG所在位置.本文将讨论以下内容: 1. 程序编译选 ...
- linux踢人命令 pkill踢人用法
首先使用who命令查看在线用户,然后踢人. 强制踢人命令格式:pkill -kill -t tty 解释: pkill -kill -t 踢人命令 tty 所踢用户的TTY或者pts/x(x代表数字) ...
- Zookeeper + Hadoop + Hbase部署备忘
网上类似的文章很多,本文只是记录下来备忘.本文分四大步骤: 准备工作.安装zookeeper.安装hadoop.安装hbase,下面分别详细介绍: 一 准备工作 1. 下载 zookeeper.had ...
- ANDROID_MARS学习笔记_S01_011ProgressBar
文档是这样来设置样式 <ProgressBar android:layout_width="wrap_content" android:layout_height=" ...
- Android2.3.7源码结构分析
对Andorid系统进行分析或者系统功能定制的时候,我们经常需要在众多文件中花费大量时间定位所需关注的部分.为了减轻这部分枯燥而不可避免的工作,本文对2.3.7版本的源码结构进行了简单分析.希望对刚加 ...
- 【HDOJ】4355 Party All the Time
好久没做过三分的题目了. /* 4355 */ #include <iostream> #include <sstream> #include <string> # ...
- the field is sometimes used inside synchronized block and sometimes used without synchronization
http://stackoverflow.com/questions/28715625/is-it-safe-to-use-field-inside-and-outside-synchronized- ...
- Hadoop课程介绍
一.课程简介 1. Hadoop是什么? Apache Hadoop是一款支持数据密集型分布式应用并以Apache 2.0许可协议发布的开源软件框架.它支持在商品硬件构建的大型集群上运行的应用程序.H ...
- 腾讯TDW:大型Hadoop集群应用[转载]
转自:http://www.uml.org.cn/sjjm/201508103.asp 作者:Uri Margalit 来源:InfoQ 发布于:2015-8-10 TDW(Tencent dist ...