Poj 1673 exocenter of a triangle

Source: Internet
Author: User

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 ;
}


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.