Poj_1673
O is actually the focus of △abc, and the proof is as follows:
First, we rotate △ebj around B point counterclockwise for 90 degrees. Then EB and AB overlap, and BJ and BC are collocated. The reason why BJ and BC are co-located is that they are complementary before ABC and ∠ ebj. At this time, there will be a large combination of triangle △jac, and BC = BJ, Me = MJ, so me is the middle line of △jac, so BM is parallel to AC. The BM is parallel to the AC after 90 degrees of rotation, so the BM is perpendicular to the AC, and then we can get that O is the center of △abc.
When outputting this question, you need to add a small volume (EPS) such as 1e-8 and then output it. As for why I don't understand it, when we look at discuss and say it is best to add an EPS and attention to the output results of calculation geometric questions.
# Include <stdio. h>
# Include < String . H>
# Include <math. h>
# Define Zero 1e-8
Double X3, Y3, X4, Y4, X5, Y5;
Int DCMP ( Double X)
{
Return FABS (x) <zero? 0 : (X < 0 ? - 1 : 1 );
}
Void Solve ()
{
Double X, Y, X1, Y1, X2, Y2, K1, K2;
If (DCMP (Y3-Y4) = 0 )
{
K2 = (X4-X5)/(Y5-Y4 );
X = X5;
Y = k2 * (X-X3) + Y3;
}
Else
{
If (DCMP (Y4-Y5) = 0 )
{
K1 = (X3-X4)/(Y4-Y3 );
X = X3;
Y = K1 * (X-X5) + Y5;
}
Else
{
K1 = (X3-X4)/(Y4-Y3 );
K2 = (X4-X5)/(Y5-Y4 );
X = (K1 * X5-K2 * X3 + Y3-Y5)/(K1-K2 );
Y = K1 * (X-X5) + Y5;
}
}
Printf ( " %. 4lf %. 4lf \ n " , X + zero, Y + zero );
}
Int Main ()
{
Int T;
Scanf ( " % D " , & T );
While (T --)
{
Scanf ( " % Lf " , & X3, & Y3, & X4, & Y4, & X5, & Y5 );
Solve ();
}
Return 0 ;
}