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

Posted yoooshinow

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[日常摸鱼]Uva11178Morley's Theorem-几何相关的知识,希望对你有一定的参考价值。

题意:给一个$\Delta ABC$,分别做三个角的三等分线相交成$\Delta DEF$,求出$D,E,F$的坐标。

 


 

直接根据题意模拟

技术分享图片
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
struct Point
{
    double x,y;
    Point(double x1=0,double y1=0){x=x1;y=y1;}
};
typedef Point Vector;

inline Vector operator +(Point a,Point b)
{
    return Vector(a.x+b.x,a.y+b.y);
}

inline Vector operator -(Point a,Point b)
{
    return Vector(a.x-b.x,a.y-b.y);
}

inline Vector operator *(double t,Vector a)
{
    return Vector(a.x*t,a.y*t);
}

inline Vector ratate(Vector v,double a)
{
    return Vector(v.x*cos(a)-v.y*sin(a),v.x*sin(a)+v.y*cos(a));
}

inline double Dot(Vector a,Vector b)
{
    return a.x*b.x+a.y*b.y;
}

inline double len(Vector a)
{
    return sqrt(Dot(a,a));
}

inline double angle(Vector a,Vector b)
{
    return acos(Dot(a,b)/len(a)/len(b));
}

inline double Cross(Vector a,Vector b)
{
    return a.x*b.y-a.y*b.x;
}

inline Point getLineIntersection(Point A,Point B,Vector v1,Vector v2)
{
    Vector u=A-B;
    double t=Cross(v2,u)/Cross(v1,v2);
    return A+t*v1;
}

inline Point solve(Point A,Point B,Point C)
{
    Vector v1=C-B,v2=B-C;
    double alpha=angle(v1,A-B),beta=angle(v2,A-C);
    v1=ratate(v1,alpha/3);v2=ratate(v2,-beta/3);
    return getLineIntersection(B,C,v1,v2);
}

inline Point readPoint()
{
    double x,y;
    scanf("%lf%lf",&x,&y);
    return Point(x,y);
}

int main()
{
    Point A,B,C,D,E,F;
    int T;
    scanf("%d",&T);
    while(T--)
    {
        A=readPoint();B=readPoint();C=readPoint();
        D=solve(A,B,C);E=solve(B,C,A);F=solve(C,A,B);
        printf("%.6lf %.6lf %.6lf %.6lf %.6lf %.6lf\n",D.x,D.y,E.x,E.y,F.x,F.y); 
    }
    return 0;
}
View Code

 

以上是关于[日常摸鱼]Uva11178Morley's Theorem-几何的主要内容,如果未能解决你的问题,请参考以下文章

A - Morley's Theorem UVA - 11178

UVA11178 Morley's Theorem

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

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

UVA - 11178-Morley’s Theorem

UVA - 11178