UVA - 11178

Posted gggyt

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UVA - 11178相关的知识,希望对你有一定的参考价值。

  存板子(●‘?‘●)

#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);
}
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;
}
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\n",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;
}

 

以上是关于UVA - 11178的主要内容,如果未能解决你的问题,请参考以下文章

UVA11178 Morley's Theorem

UVA - 11178

UVa 11178 Morley's Theorem (几何问题)

A - Morley's Theorem UVA - 11178

[日常摸鱼]Uva11178Morley's Theorem-几何

UVA_11178_Morley's_Theorem_(向量旋转+直线相交)