UVA

  存板子(●'◡'●)

#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<cstring>
#include<queue>
#include<set>
#include<string>
#include<map>
#include <complex>
#include <time.h>
#define PI acos(-1)
using namespace std;
typedef long long ll;
typedef double db;
const int maxn = 400+1000;
const int sigma=26;
const ll mod = 1000000007;
const int INF = 0x3f3f3f;
const db eps = 1e-10;
struct point  {
    double x,y;
    point(double x=0,double y=0): x(x),y(y){}
};
typedef point Vector;
Vector operator +(point a,point b)  {
    return Vector(a.x+b.x,a.y+b.y);
}
Vector operator *(point a,double b)  {
    return Vector(a.x*b,a.y*b);
}
Vector operator -(point a,point b)  {
    return Vector(a.x-b.x,a.y-b.y);
}
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 len(Vector a)  {     //长度
    return sqrt(a.x*a.x+a.y*a.y);
}
double DistanceToLine(point p, point a, point b) {//点p到a.b形成的直线的距离
    Vector v1=b-a, v2=p-a;
    return fabs(cross(v1, v2))/len(v1);
}
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 getans(point p,Vector v,point q,Vector w){  //求两直线交点
    Vector u= p-q;
    double t=cross(w,u) / cross(v,w);
    return p+v*t;
}
db mul(point s, point e, point op) { //判断点是否在直线上
    return (s.x-op.x)*(e.y-op.y)-(e.x-op.x)*(s.y-op.y);
}
point getPoint(point a,point b,point c)  {
    Vector bc=c-b;
    Vector ba=a-b;
    double x=acos(  dot(ba,bc) / len(bc) / len(ba) );
    Vector bd= Rotate(bc,x/3);

    Vector ca=a-c;
    Vector cb=b-c;
    x=acos(  dot(cb,ca) / len(cb) / len(ca) );
    Vector cd=Rotate(cb,-x/3);

    return getans(b,bd,c,cd);
}
void solve() {
    point a,b,c,d,e,f;
    scanf("%lf%lf",&a.x,&a.y);
    scanf("%lf%lf",&b.x,&b.y);
    scanf("%lf%lf",&c.x,&c.y);
    d=getPoint(a,b,c);
    e=getPoint(b,c,a);
    f=getPoint(c,a,b);
    printf("%.6lf %.6lf %.6lf %.6lf %.6lf %.6lf
",d.x,d.y,e.x,e.y,f.x,f.y);

}
int main() {
    int t = 1;
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    scanf("%d", &t);
    while(t--) {
        solve();
    }
    return 0;
}
原文地址:https://www.cnblogs.com/gggyt/p/7655608.html