UVa 11178 Morley ' s theorem (geometrical problems)

Source: Internet
Author: User

Test instructions: The three points of a given triangle allow you to ask for the vertices of each of the three equal lines in each corner.

Analysis: According to their previous mathematical knowledge, it should be easy to think of ideas, such as D point, should be asked straight BD and CD intersection,

Before you have to calculate, now the computer to help you calculate, more convenient, the main note is the rotation is clockwise or counterclockwise, do not make a mistake.

BD and CD are required to ask for the angle ABC and ACD first, then the three halves.

The code is as follows:

#include <iostream> #include <cstdio> #include <cstring> #include <cmath>using namespace std;    const int MAXN = + 10;const Double eps = 1e-10;struct point{double x, y; Point (double xx = 0, double yy = 0): X (xx), Y (yy) {}};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);  }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; }vector Rotate (Vector A, double rad) {return vector (A.x*cos (RAD)-a.y*sin (RAD), A.x*sin (RAD) +a.y*cos (RAD));}    Point Getlineintersection (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 Solve (Point A, point B, point C) {Double ABC = Angle (b, c-b)/3.0;    Vector BD = Rotate (c-b, ABC);    Double ACB = Angle (a-c, B-C)/3.0;    Vector CD = Rotate (b-c,-ACB); Return Getlineintersection (B, BD, C, CD);}  int main () {int T;    Cin >> T;    Point A, B, C, D, E, F;    Double x, y;   while (t--) {scanf ("%lf%lf", &x, &y);        A = Point (x, y);   scanf ("%lf%lf", &x, &y);        B = Point (x, y);   scanf ("%lf%lf", &x, &y);        C = Point (x, y);        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;}

UVa 11178 Morley ' s theorem (geometrical problems)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.