简单几何(求交点) UVA 11178 Morley's Theorem
题意:莫雷定理,求三个点的坐标
分析:训练指南P259,用到了求角度,向量旋转,求射线交点
/************************************************
* Author :Running_Time
* Created Time :2015/10/21 星期三 15:56:27
* File Name :UVA_11178.cpp
************************************************/ #include <cstdio>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <bitset>
#include <cstdlib>
#include <ctime>
using namespace std; #define lson l, mid, rt << 1
#define rson mid + 1, r, rt << 1 | 1
typedef long long ll;
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const double EPS = 1e-10;
struct Point {
double x, y;
Point (double x=0, double y=0) : x (x), y (y) {}
};
typedef Point Vector;
double dot(Vector A, Vector B) {
return A.x * B.x + A.y * B.y;
}
double cross(Vector A, Vector B) {
return A.x * B.y - A.y * B.x;
}
int dcmp(double x) {
if (fabs (x) < EPS) return 0;
else return x < 0 ? -1 : 1;
}
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);
}
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) {
return Vector (A.x * cos (rad) - A.y * sin (rad), A.x * sin (rad) + A.y * cos (rad));
}
Point point_inter(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 solve(Point a, Point b, Point c) {
Vector V1 = c - b;
double r1 = angle (a - b, V1);
V1 = rotate (V1, r1 / 3);
Vector V2 = b - c;
double r2 = angle (a - c, V2);
V2 = rotate (V2, -r2 / 3);
return point_inter (b, V1, c, V2);
} int main(void) {
int T; scanf ("%d", &T);
Point a, b, c, d, e, f;
while (T--) {
scanf ("%lf %lf %lf %lf %lf %lf", &a.x, &a.y, &b.x, &b.y, &c.x, &c.y);
d = solve (a, b, c);
e = solve (b, c, a);
f = solve (c, a, b);
printf ("%.6f %.6f %.6f %.6f %.6f %.6f\n", d.x, d.y, e.x, e.y, f.x, f.y);
} return 0;
}
简单几何(求交点) UVA 11178 Morley's Theorem的更多相关文章
- 简单几何(求交点) UVA 11437 Triangle Fun
题目传送门 题意:三角形三等分点连线组成的三角形面积 分析:入门题,先求三等分点,再求交点,最后求面积.还可以用梅涅劳斯定理来做 /********************************** ...
- 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(几何)
Morley's Theorem [题目链接]Morley's Theorem [题目类型]几何 &题解: 蓝书P259 简单的几何模拟,但要熟练的应用模板,还有注意模板的适用范围和传参不要传 ...
- UVa 11178:Morley’s Theorem(两射线交点)
Problem DMorley’s TheoremInput: Standard Input Output: Standard Output Morley’s theorem states that ...
- 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 (几何问题)
题意:给定三角形的三个点,让你求它每个角的三等分线所交的顶点. 析:根据自己的以前的数学知识,应该很容易想到思想,比如D点,就是应该求直线BD和CD的交点, 以前还得自己算,现在计算机帮你算,更方便, ...
- UVA 11178 Morley's Theorem(旋转+直线交点)
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18543 [思路] 旋转+直线交点 第一个计算几何题,照着书上代码打 ...
随机推荐
- 【Java】Java代码经典错误清单
一.String 对照 == 和 equals.详细描写叙述例如以下 "=="操作符的作用 1)用于基本数据类型的比較,例如以下: byte(字节) 8 -128 - 127 0 ...
- HDU 6078 Wavel Sequence 树状数组优化DP
Wavel Sequence Problem Description Have you ever seen the wave? It's a wonderful view of nature. Lit ...
- SpringInAction4笔记——装配
重点:常用的上下文环境 AnnotationConfigApplicationContext ClassPathXmlApplicationContext FileSystemXmlApplicati ...
- 理解yarn平台,理解万岁,肤浅理解也万岁~
从Hadoop1到Hadoop2很大程度上解放了Jobtracker资源调度的问题,这就得多亏了yarn平台了.我知道的,除了我们的大豆瓣用的是Mesos,咱们国家可以说应该是99.99%都使用的是y ...
- VC实现趋势图绘制
本文参考pudn上一个完整工程,在pudn搜索“50815867CurveDrawing”即可找到源代码. 上图是使用VS2010重写了该软件后的效果图,下面再贴出关键代码: // Plot.cp ...
- PM12条
PM首先是用户 站在用户角度看待问题 用户体验是一个完整的过程 追求效果,不做没用的东西 发现需求,而不是创造需求 决定不做什么,往往比决定做什么更重要 用户是很难被教育的,要迎合用户,而不是改变用户 ...
- NOT IN clause and NULL values
https://stackoverflow.com/questions/129077/not-in-clause-and-null-values This issue came up when I g ...
- poj 1258 Agri-Net 解题报告
题目链接:http://poj.org/problem?id=1258 题目意思:给出 n 个 farm,每个farm 之间通过一定数量的fiber 相连,问使得所有farm 直接或间接连通的 最少 ...
- 笔记本电脑处理器(CPU)性能排行榜
笔记本电脑处理器(CPU)性能排行榜 本排行榜随新款处理器(CPU)的发布而随时更新.更新日期:2012年7月15日 排名 型号 二级+三级缓存 前端总线(MHz) 功率(瓦) 主频(MHz) 核 ...
- sharepoint服务器修改密码后出现HTTP Error 503
HTTP Error 503 解决办法: 更改sharepoint 网站应用程序池标示后,更改标示重新输入管理员密码,问题解决!