作三角形ABC每個內角的三等分線,相交成三角形DEF,則DEF是等邊三角形。給出A、B、C 3個的位置確定D、E、F 3個點的位置
涉及知識:
1.向量的旋轉
2.兩條直線求交點(已知兩點)
3.兩向量求夾角
/********************************************
Author :Crystal
Created Time :
File Name :
********************************************/
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <climits>
#include <string>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <sstream>
#include <cctype>
using namespace std;
typedef long long ll;
typedef pair<int ,int> pii;
#define MEM(a,b) memset(a,b,sizeof a)
#define CLR(a) memset(a,0,sizeof a);
const int inf = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const double eps = 1e-10;
#define LOCAL
// 兩條直線求交點
// 兩條直線求夾角
//向量的旋轉
struct Point
{
/* data */
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);}
bool operator < (const Point& a , const Point& b){
return a.x < b.x || (a.x == b.x && a.y < b.y);
}
int dcmp(double x){
if(fabs(x) < eps) return 0;
return x < 0 ? -1 : 1;
}
bool operator == (const Point& a, const Point& b){
return dcmp(a.x - b.x) == 0 && dcmp(a.y - b.y) == 0;
}
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;}//叉乘
double Area(Point A, Point B, Point C){return Cross(B-A,C-A);}//三角形面積
Vector Rotate(Vector A, double rad){
// 向量a逆時針旋轉rad弧度後的座標
return Vector(A.x*cos(rad) - A.y*sin(rad),A.x*sin(rad)-A.y*cos(rad));
}
//求直線交點
Point getline_intersection(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 get(Point a, Point b, Point c){
Vector v1 = c - b;
double a1 = Angle(a-b,v1);
v1 = Rotate(v1, a1/3);
Vector v2 = b - c;
double a2 = Angle(a-c, v2);
v2 = Rotate(v2, -a2/3);
return getline_intersection(b, v1, c, v2);
}
int main()
{
#ifdef LOCAL
freopen("in.txt", "r", stdin);
// freopen("out.txt","w",stdout);
#endif
int t;cin >> t;
Point a,b,c,d,e,f;
while(t--){
cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y;
d = get(a,b,c);
e = get(b,c,a);
f = get(c,a,b);
printf("%lf %lf %lf %lf %lf %lf\n",d.x , d.y , e.x , e.y, f.x, f.y);
}
return 0;
}