Uva11178:
The main idea: according to the Morley theorem, we can know that the three corners of the arbitrary triangle will hand over a equilateral triangle, so now give the triangle three vertices A, B, C, please calculate D, E, F.
Analysis: Most of the geometry of the problem of mathematical analysis is relatively simple, but the implementation is more cumbersome. This problem is actually the calculation of three straight line intersection, and in each calculation process, the two straight lines are two corners of the three equal lines near the part of their public side.
So how to solve this line? involves vector rotation.
How is the intersection solved? Intersecting lines are involved in finding intersections.
It is necessary to combine the knowledge of some analytic geometry and then introduce a simpler formula with less precision, and then perform the operation after the integration function, the simple reference code is as follows:
#include <cstdio>#include<cstring>#include<cmath>using namespacestd;structpoint{Doublex, y; Point (Doublex =0,Doubley =0): x (x), Y (y) {};//It is convenient to use the constructor directly when defining the point.};typedef point Vector;//this is because vectors have ordered parameters of two dimensions.Vectoroperator+ (Vector a,vector B) {returnVector (a.x+b.x, a.y+b.y);} Vectoroperator-(point A,point B) {returnVector (a.x-b.x, a.y-b.y);} Vectoroperator* (Vector A,DoubleP) {returnVector (A.x*p, a.y*p);} Vectoroperator/(Vector A,DoubleP) {returnVector (a.x/p, a.y/p);}DoubleCross (vector A, vector B)//Vector cross product{ returna.x * B.Y-A.Y *b.x;} Point Getlineintersection (Point P, Vector v, point Q, Vector W)//Two line intersection (parametric method){Vector u= Pp; Doublet = Cross (w, u)/Cross (V, W); returnp+v*T;} Vector Rotate (vector A,Doublerad//Vector Rotation (counterclockwise is positive angle){ returnVector (A.x*cos (RAD)-A.y*sin (RAD), A.x*sin (RAD) + a.y*cos (RAD));}DoubleDot (vector A, vector B) {returna.x*b.x + a.y*b.y;}//Vector Point multiplicationDoubleLength (Vector A) {returnsqrt (Dot (a,a));}//vector modulus LengthDoubleAngle (vector A, vector B) {returnACOs (Dot (A)/length (A)/length (B));//angle between vectorsPoint getd (Point A, point B, point C) {Vector v1= C-B; DoubleA1 = Angle (A-B, v1); V1= Rotate (v1, a1/3); Vector v2= B-C; DoubleA2 = Angle (A-C, v2); V2= Rotate (v2,-a2/3); returngetlineintersection (B, v1, C, v2);}intMain () {intT; Point A,b,c,d,e,f; scanf ("%d",&T); while(t--) {scanf ("%LF%LF%LF%LF%LF%LF",&a.x,&a.y,&b.x,&b.y,&c.x,&c.y); D=getd (A,B,C); E=getd (b,c,a); F=getd (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;}
"Training Guide"--8.1