Description
Morley定理:作三角形ABC每个内角的三等分线,相交成三角形DEF,则三角形DEF为等边三角形。
给定A,B,CA,B,C,求D,E,FD,E,F坐标。
Solution
计算几何入门题。
先求出∠BAC,∠ABC∠BAC,∠ABC,除以33,将AB旋转求出的角度,得到,算出交点FF。同理。
Source
/****************************
* Au: Hany01
* Prob: UVa11178 Morley's Theorem
* Date: Feb 9th, 2018
* Email: hany01@foxmail.com
****************************/
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define rep(i , j) for (int i = 0 , i##_end_ = j; i < i##_end_ ; ++ i)
#define For(i , j , k) for (int i = (j) , i##_end_ = (k) ; i <= i##_end_ ; ++ i)
#define Fordown(i , j , k) for (int i = (j) , i##_end_ = (k) ; i >= i##_end_ ; -- i)
#define Set(a , b) memset(a , b , sizeof(a))
#define SZ(a) ((int)(a.size()))
#define ALL(a) a.begin(), a.end()
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define INF (0x3f3f3f3f)
#define INF1 (2139062143)
#define Mod (1000000007)
#define y1 wozenmezhemecaia
#ifdef hany01
#define debug(...) fprintf(stderr , __VA_ARGS__)
#else
#define debug(...)
#endif
inline void File() {
#ifdef hany01
freopen("uva11178.in" , "r" , stdin);
freopen("uva11178.out" , "w" , stdout);
#endif
}
template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
inline int read() {
register char c_; register int _ , __;
for (_ = 0 , __ = 1 , c_ = getchar() ; !isdigit(c_) ; c_ = getchar()) if (c_ == '-') __ = -1;
for ( ; isdigit(c_) ; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
return _ * __;
}
const double eps = 1e-10, Pi = acos(-1.0);
struct Point
{
double x, y;
Point(double x = 0, double y = 0): 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 - (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); }
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 Cross(Vector A, Vector B) { return A.x * B.y - A.y * B.x; }
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 v, double rad) { return Vector(v.x * cos(rad) - v.y * sin(rad), v.x * sin(rad) + v.y * cos(rad)); }
Point Projection(Point P, Vector v, Point Q, Vector w) { Vector u = P - Q; return P + v * Cross(w, u) / Cross(v, w); }
Point Solve(Point A, Point B, Point C)
{
Point F;
Vector AF, BF;
double Ang_BAC, Ang_BAF, Ang_ABC, Ang_ABF;
Ang_BAC = Angle(B - A, C - A);
Ang_BAF = Ang_BAC / 3;
AF = Rotate(B - A, Ang_BAF);
Ang_ABC = Angle(A - B, C - B);
Ang_ABF = Ang_ABC / 3;
BF = Rotate(A - B, 2 * Pi - Ang_ABF);
F = Projection(A, AF, B, BF);
return F;
}
int main()
{
File();
Point A, B, C, D, E, F;
for (register int T = read(); T --; ) {
scanf("%lf%lf%lf%lf%lf%lf", &A.x, &A.y, &B.x, &B.y, &C.x, &C.y);
F = Solve(A, B, C), E = Solve(C, A, B), D = Solve(B, C, A);
printf("%.6lf %.6lf %.6lf %.6lf %.6lf %.6lf\n", D.x, D.y, E.x, E.y, F.x, F.y);
}
return 0;
}