#include<cstdio>
#include<cmath>
using namespace std;
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 - (Point A, Point 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); }
Point read_point(){
Point p;
scanf("%lf%lf", &p.x, &p.y);
return 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));
}
Vector Rotate(Vector A, double rad){
return Vector(A.x*cos(rad)-A.y*sin(rad), A.x*sin(rad)+A.y*cos(rad));
}
double Cross(Vector v1, Vector v2){
return v1.x*v2.y-v1.y*v2.x;
}
Point GetLineIntersection(Point A, Vector v1, Point B, Vector v2){
Vector v3=A-B;
double t=Cross(v2, v3)/Cross(v1, v2);
return A+v1*t;
}
Point getP(Point A, Point B, Point C){
Vector v1=B-A;
double a1=Angle(v1, C-A);
v1=Rotate(v1, a1/3);
Vector v2=A-B;
double a2=Angle(v2, C-B);
v2=Rotate(v2, -a2/3);
return GetLineIntersection(A, v1, B, v2);
}
int main(){
int T;
scanf("%d", &T);
while(T--){
Point A, B, C, D, E, F;
A=read_point();
B=read_point();
C=read_point();
D=getP(B, C, A);
E=getP(C, A, B);
F=getP(A, B, C);
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(几何,蓝书)
最新推荐文章于 2020-10-04 19:59:21 发布