题目传送门

题意:莫雷定理,求三个点的坐标

分析:训练指南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的更多相关文章

  1. 简单几何(求交点) UVA 11437 Triangle Fun

    题目传送门 题意:三角形三等分点连线组成的三角形面积 分析:入门题,先求三等分点,再求交点,最后求面积.还可以用梅涅劳斯定理来做 /********************************** ...

  2. uva 11178 - Morley's Theorem

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

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

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

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

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

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

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

  6. UVA 11178 - Morley's Theorem 向量

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

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

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

  8. UVa 11178 Morley's Theorem (几何问题)

    题意:给定三角形的三个点,让你求它每个角的三等分线所交的顶点. 析:根据自己的以前的数学知识,应该很容易想到思想,比如D点,就是应该求直线BD和CD的交点, 以前还得自己算,现在计算机帮你算,更方便, ...

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

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

随机推荐

  1. Hibernate_14_数据连接池的使用

    在主配置文件Hibernate.cfg.xml中设置: <!-- 设置默认的事务隔离级别: 隔离级别 相应的整数表示 READ UNCOMMITED 1 READ COMMITED 2 REPE ...

  2. 您可能试图从server上的安全浏览器訪问此站点。请启用脚本然后又一次载入此页。

    您可能试图从server上的安全浏览器訪问此站点.请启用脚本然后又一次载入此页.         我使用域Admin组的账户登入SharePoint2010的server,打开SharePoint首页 ...

  3. 在VS2010中使用MySQL-转载

    下面这篇文章进过测试,确实可以.记下来,留作记录. http://blog.sina.com.cn/s/blog_782496390100qjcu.html

  4. ios实现倒计时的两种方法

    方法1:使用NSTimer来实现 主要使用的是NSTimer的scheduledTimerWithTimeInterval方法来每1秒执行一次timeFireMethod函数,timeFireMeth ...

  5. 数据结构之 图论---bfs(邻接表)

    数据结构实验之图论二:基于邻接表的广度优先搜索遍历 Time Limit: 1000MS Memory limit: 65536K 题目描述 给定一个无向连通图,顶点编号从0到n-1,用广度优先搜索( ...

  6. svn服务器搭建与迁移

    2016-11-21更新: 今天被svn的钩子搞了半天,网上找解决方法都无效,下午被我试出来了,特此记录. 在svn的钩子中可以使用update来更新配置文件,比如ansible的,puppet的,具 ...

  7. 缓存框架Ehcache相关

    单点缓存框架   只能针对单个jvm中,缓存容器存放jvm中,每个缓存互不影响  Ehcache gauva chache 内置缓存框架 jvm缓存框架 分布式缓存框架(共享缓存数据)  Redis ...

  8. YTU 2424: C语言习题 字符串比较

    2424: C语言习题 字符串比较 时间限制: 1 Sec  内存限制: 128 MB 提交: 1042  解决: 613 题目描述 写一函数,实现两个字符串的比较.即自己写一个strcmp函数,函数 ...

  9. 域名ip自动跳转 跳转指定页面的js

    域名ip自动跳转 跳转指定页面的js 为了应对百度审核,需要客户的网站在个别地区跳转到另一个页面,就搞到了这段代码,屡试不爽,超实用.下面把地址换成你要访问的网站url地址或者文件url地址即可.超实 ...

  10. 织梦dedecms标签调用集合,绝对是仿站必备利器

    今天分享下整理了织梦dedecms标签调用集合,绝对是仿站必备利器啊,觉得有用就转走吧!温馨小提示:CTRL+F 搜索你需要的标签名,就可以方便找到:织梦dedecms标签调用集合-首页标签:网站导航 ...