题意:给定三角形的三个点,让你求它每个角的三等分线所交的顶点。

析:根据自己的以前的数学知识,应该很容易想到思想,比如D点,就是应该求直线BD和CD的交点,

以前还得自己算,现在计算机帮你算,更方便,主要注意的是旋转是顺时针还是逆时针,不要搞错了。

要求BD和CD就得先求那个夹角ABC和ACD,然后三等分。

代码如下:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath> using namespace std;
const int maxn = 500 + 10;
const double eps = 1E-10;
struct Point{
double x, y;
Point(double xx = 0, double yy = 0) : x(xx), y(yy) { }
};
typedef Point Vector; 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 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; }
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 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 solve(Point A, Point B, Point C){
double abc = Angle(A-B, C-B) / 3.0;
Vector BD = Rotate(C-B, abc);
double acb = Angle(A-C, B-C) / 3.0;
Vector CD = Rotate(B-C, -acb); return GetLineIntersection(B, BD, C, CD);
} int main(){
int T; cin >> T;
Point A, B, C, D, E, F;
double x, y;
while(T--){
scanf("%lf %lf", &x, &y); A = Point(x, y);
scanf("%lf %lf", &x, &y); B = Point(x, y);
scanf("%lf %lf", &x, &y); C = Point(x, y); D = solve(A, B, C);
E = solve(B, C, A);
F = solve(C, A, B);
printf("%.6lf %.6lf %.6lf %.6lf %.6lf %.6lf\n", D.x, D.y, E.x, E.y, F.x, F.y);
}
return 0;
}

UVa 11178 Morley's Theorem (几何问题)的更多相关文章

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

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

  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 (坐标旋转)

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

  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

    题目传送门 题意:莫雷定理,求三个点的坐标 分析:训练指南P259,用到了求角度,向量旋转,求射线交点 /*********************************************** ...

  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(旋转+直线交点)

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

  9. UVA 11178 Morley's Theorem 计算几何模板

    题意:训练指南259页 #include <iostream> #include <cstdio> #include <cstring> #include < ...

随机推荐

  1. app.$mount("#app") 手动挂载

    $mount()手动挂载 当Vue实例没有el属性时,则该实例尚没有挂载到某个dom中: 假如需要延迟挂载,可以在之后手动调用vm.$mount()方法来挂载.例如: new Vue({ //el: ...

  2. Qt-状态机

    //以下示例是QT示例中的appchooser例子,使用状态机来进行图标的交互. #include <QtCore> #include <QtWidgets> class Pi ...

  3. binlog、redo log、undo log区别

    root@(none) 04:17:18>show variables like 'innodb_log_group_home_dir';+--------------------------- ...

  4. eclipse 自动生成json格式的toString()方法

    文本代码 {"${member.name()}":"${member.value}", "${otherMembers}"}

  5. 如何将String转换为int

    1. int i = Integer.parseInt([String]); 或 i = Integer.parseInt([String],[int radix]); Integer.parseIn ...

  6. SpringDataRedis事务 专题

    5.10.1. @Transactional SupportTransaction Support is disabled by default and has to be explicitly en ...

  7. ubuntu搭建ftp服务器

    (1).首先用命令检查是否安装了vsftpd vsftpd -version  如果未安装用一下命令安装 sudo apt-get install vsftpd 安装完成后,再次输入vsftpd -v ...

  8. Python+Webdriver,中文前加u是unicode格式编码的意思

    Python+Webdriver写脚本时,对一些输入框赋值会涉及到输入中文,这时需要在中文前加u 举个例子,在用百度搜索时,要在搜索输入框内输入值, 我用的编码格式是utf-8,向输入框内输入值是:d ...

  9. WebDriverException: Message: f.QueryInterface is not a function

    WebDriverException: Message: f.QueryInterface is not a function 使用webdriver打开c.highpin.cn,结果报错,见下图: ...

  10. 超薄二维Mo2C晶体

    记者今天从中国科学院金属研究所获悉,该所沈阳材料科学国家(联合)实验室先进炭材料研究部任文才研究组在大尺寸高质量二维过渡族金属碳化物晶体的制备与物性研究方面取得了重要突破.相关成果日前在<自然— ...