题目传送门

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

分析:训练指南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. 项目Beta冲刺(团队3/7)

    项目Beta冲刺(团队3/7) 团队名称: 云打印 作业要求: 项目Beta冲刺(团队) 作业目标: 完成项目Beta版本 团队队员 队员学号 队员姓名 个人博客地址 备注 221600412 陈宇 ...

  2. 不能实现RadioButton默认选择

    当用RadioButton时,希望在程序运行的时候默认一个选项: CheckRadioButton(IDC_RADIO1,IDC_RADIO2,IDC_RADIO1); //CheckRadioBut ...

  3. 2016/05/27 php上传文件常见问题总结

    php上传文件常见问题总结 投稿:hebedich 字体:[增加 减小] 类型:转载 时间:2015-02-03我要评论 这篇文章主要介绍了php上传文件常见问题总结,基本上经常碰到的问题的处理都列了 ...

  4. CSS3 弹性盒子(Flex Box) 微信小程序图片通栏

    {{define "chkUrl"}} <!DOCTYPE html><html lang="zh-cmn-Hans"><head ...

  5. inherited在消息中的作用(编译器根据inherited所在的函数,直接转换成对祖先类同名动态函数的调用,或者转换成对DefaultHandler的调用)

    好奇一下.看来Object Pascal确实与Windows深入结合了. unit Unit1; interface uses Windows, Messages, SysUtils, Variant ...

  6. 动态预览Xib的实现

    写一个TestView继承于UIView,然后写个对应的xib,把xib的名字设置成TestView,这是标准的用xib加载这个view必须得条件 然后xib里把这个View的backgroundCo ...

  7. NOIP2016总结

    Day1: T1:模拟: #include<iostream> #include<cstdio> #include<cstdlib> #include<cst ...

  8. 鼠标滑过TAB选项卡切换demo 可拓展

    <html> <head> <script type="text/javascript"> <!-- function ShowTabs( ...

  9. IO、FileInputStream、(二十)

    1.IO流概述及其分类 * 1.概念(什么是IO?) * IO流用来处理设备之间的数据传输 * Java对数据的操作是通过流的方式 * Java用于操作流的类都在IO包中 * 流按流向分为两种:输入流 ...

  10. Lesson one of python

    Test1:Use the powershell to output the contents print "Hello World!" print "Hello Aga ...