Test instructions:, the coordinates of P, Q, r three points are given, AB, BC, ac are divided into m1:m2, M3:M4, and E by the points F, D, and C, and the values of M1~M6 are given, and the coordinates of the three vertices A, B and D of ABC are obtained.
The puzzle: According to the Meneraus theorem, if there are two triangles that are composed of:
Conclusion: (BD/DC) x (ce/ea) x (AF/FB) =1
To prove the omission, the direct use of the conclusion, the triangle given in the title has 6 sets of such triangles, respectively, can be introduced in the following two sides of the ratio:
CBQ and Cdr--> Dp/cq
BAP and Bfq--> FR/BP
ACR and Ape--> Qe/ar
CBE and Cda--> Dp/pa
Bad and bfc--> FR/CR
ACF and Aeb--> EQ/BQ
Set DP to X, you can all the edges are expressed as about the X, and finally push back to DP, is a one-time equation about X, directly solve the equation on the length of the DP, and then the length of all sides can be obtained, in order to get the coordinates of a, B, C, Let the point r in the direction of the vector pr to move ar distance to get a, the remaining two points similar to arrive.
#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>using namespace STD;Const DoublePI =ACOs(-1);Const DoubleEPS =1e-9;structPoint {Doublex, y; Point (DoubleA =0,Doubleb =0): X (a), Y (b) {}};typedefPoint Vector;DoubleDCMP (Doublex) {if(fabs(x) < EPS)return 0;returnX <0? -1:1;} Vectoroperator+ (Constpoint& A,Constpoint& B) {returnVector (a.x + b.x, A.Y + b.y);} Vectoroperator- (Constpoint& A,Constpoint& B) {returnVector (a.x-b.x, a.y-b.y);} Vectoroperator* (Constpoint& A,DoubleA) {returnVector (a.x * A, A.Y * a);} Vectoroperator/ (Constpoint& A,DoubleA) {returnVector (a.x/a, a.y/a);}DoubleCross (Constvector& A,Constvector& B) {returna.x * B.Y-A.Y * b.x;}DoubleDot (Constvector& A,Constvector& B) {returna.x * b.x + a.y * B.Y;}DoubleLength (Constvector& A) {return sqrt(Dot (A, a));}BOOL operator< (Constpoint& A,Constpoint& B) {returna.x < b.x | | (a.x = = b.x && a.y < B.Y);}BOOL operator== (Constpoint& A,Constpoint& B) {returna.x = = b.x && A.y = = b.y;} Point P, Q, R;DoubleM1, M2, M3, M4, M5, M6;intMain () {intTscanf("%d", &t); while(t--) {scanf("%LF%LF%LF%LF%LF%LF", &p.x, &p.y, &q.x, &q.y, &r.x, &R.Y);scanf("%LF%LF%LF%LF%LF%LF", &M1, &m2, &m3, &M4, &M5, &M6);DoubleRP = Length (p-r);DoubleRQ = Length (r-q);DoublePQ = Length (p-q);DoubleT1 = M1 * RP/(m1 + m2)/RQ;//Dp/cq DoubleT2 = M5 * RQ/(M5 + M6)/PQ;//FR/BP DoubleT3 = m3 * PQ/(M3 + M4)/RP;//Qe/ar DoubleT4 = m1 * m3/(m1 + m2)/M4;//Dp/pa DoubleT5 = M1 * M5/(M5 + M6)/m2;//FR/CR DoubleT6 = M3 * M5/(M3 + M4)/M6;//EQ/BQ DoubleDP = (T4 * RP + T6 * T4 * PQ/T3 + T6 * T5 * T4 * rq/t3/t2)/(1-T6 * T5 * t4/t3/t2/t1);DoubleAR = DP/T4-RP; Point A = R + (r-p) * (AR/RP);DoubleBP = T5/t2 * (dp/t1 + RQ); Point B = P + (p-q) * (BP/PQ);DoubleCQ = DP/T1; Point C = Q + (q-r) * (CQ/RQ);printf("%.8lf%.8lf%.8lf%.8lf%.8lf%.8lf\n", a.x, A.y, b.x, B.y, c.x, C.Y); }return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Uvalive 4413 (Meneraus theorem)