Poj 1673 exocenter of a triangle (Triangle center Center)

Source: Internet
Author: User
Exocenter of a triangle
Time limit:1000 ms   Memory limit:10000 K
Total submissions:2947   Accepted:1116

Description

Given a Triangle ABC, The extriangles of ABC are constructed as follows:
On each side of ABC, construct a square (abde, bchj and acfg in the figure below ).
Connect adjacent square corners to form the three extriangles (AGD, bej and CFH in the figure ).
The exomedians of ABC are the medians of the extriangles, which pass through vertices of the original triangle, extended into the original triangle (Lao, MBO and NCO in the figure. as the figure indicates, the three exomedians intersect at a common point called
The exocenter (point O in the figure ).
This problem is to write a program to compute the exocenters of triangles.

Input

The first line of the input consists of a positive integer N, which is the number of datasets that follow. each dataset consists of 3 lines; each line contains two floating point values which represent the (two-dimeneting) Coordinate of one vertex of a triangle.
So, there are total of (N * 3) + 1 lines of input. note: All input triangles wi ll be strongly non-degenerate in that no vertex will be within one unit of the line through the other two vertices.

Output

For each dataset you must print out the coordinates of the exocenter of the input triangle correct to four decimal places.

Sample Input

 
20.0 0.09.0 12.014.0 0.03.0 2.16192.162.0-10.0

Sample output

 
9.0000 3.7500-48.0400 23.3600

Source

Greater New York 2003

Question: http://poj.org/problem? Id = 1673

Question: give you a triangle, draw various pictures, give a new definition, and finally convert it into a question of looking down

Analysis: triangle center, enumeration of two sides, can calculate the pole angle perpendicular to them, and then list the two equations to solve the problem, directly copyCodeJust do

PS: This question is quite disgusting. Fortunately, poj has discuss and takes a glance at it. The answer is to add an EPS to AC =

Code:

 # include 
  
    # include 
   
     # include 
    
      using namespace STD; double ax, ay, BX, by, CX, Cy, R, A1, A2, X, Y; int N; int main () {scanf ("% d", & N); While (n --) {scanf ("% lf", & ax, & ay, & BX, & by, & CX, & CY ); a1 = atan2 (by-ay, Bx-Ax) + ACOs (-1.0)/2; a2 = atan2 (Cy-by, CX-bx) + ACOs (-1.0) /2; r = (sin (A2) * (CX-Ax) + cos (A2) * (Ay-cy)/(sin (A1) * Cos (A2) -Sin (A2) * Cos (A1); X = cx + R * Cos (A1), Y = Cy + R * sin (A1); printf ("%. 4lf %. 4lf \ n ", x + 1e-8, Y + 1e-8);} 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.