ACM Learning process-hdu5476 Explore track of point (plane geometry) (2015 Shanghai online game 09)

Source: Internet
Author: User
Tags apc

Problem Description

In Geometry, the problem of track is very interesting. Because in some cases, and the track of point is beautiful curve. For example, with polar coordinate system,ρ=cos3θis like rose,ρ=1−sinθis a cardioid, and so on. Today, there is a simple problem on it which you need to solve.

Give a triangleδabc Andab = AC. M is the midpoint of BC. Point P is INΔABC and makes MIN{∠MPB+∠APC,∠MPC+∠APB} maximum. The track of P isγ. Wouldyou Mind Calculating the length ofγ?

Given the coordinate of A, B, C, please output the length ofγ.

Input

There is T (1≤t≤104) test cases. For each case, one lineincludes six integers the coordinate of A, B, and C in order. It is guaranteed Thatab = AC and three points be not collinear. All coordinates does not exceed 104 by absolute value.

Output

For each case, first click Output "Case#k:", K is the number of the test case. See sample output for more detail. Then, please output the length of ofγwithexactly 4 digits after the decimal point.

Sample Input

1

0 1-1 0) 1 0

Sample Output

Case #1:3.2214

A slightly converted question becomes the locus of the ∠mpb+∠apc=∠mpc+∠apb=180 point P.

This final conclusion is a plane geometry problem, the high school several races although has made the plane geometry, but basically all forgot, the theorem also only remembers one Meneraus theorem ... Although it was very weak at the time.

High School Several Liping a few is very strong @hqwhqwhq, sure enough after the game to explain the trajectory to find the process.

http://blog.csdn.net/u014610830/article/details/48753415

Although the process is not much understood, but the process of proof is basically understood.

If you can guess the trajectory of the problem will be solved, the remaining is how to prove that the trajectory to meet the conditions.

The first triangle of high am is to meet the conditions, the basic is no problem.

Secondly, the B and C points are found to meet the conditions under the limit condition, because of symmetry, basically the remaining trajectory is a graph of B and C ...

Lucky to guess it is a circle can solve ...

Steal a Picture:

The conclusion is that the remaining figure is AB over B perpendicular to AC over C perpendicular to the point m, to M as the center, BM is the radius of the arc.

Next proves that:

For a certain point on the arc P,ap extended round at point D,

If visual, ∠BPM =∠CPD. The conclusion is this, and the next step is to prove it.

Since the B, P, C, D Four points are round, according to Ptolemy's theorem:

Cp*bd+bp*cd= BC*DP

By the secant theorem according to:

Ab*ab =ap*ad

So, the triangular APB is similar to the triangular abd

So bp/bd= ab/ad

Similarly: cp/cd= ac/ad

and Ab=ac.

So bp/bd= CP/CD

namely bp*cd= CP*BD

Union above Ptolemy 2BP*CD = 2CP*BD = BC*DP = 2BM*DP

Extract bp*cd= BM*DP

namely bp/bm= DP/CD

and ∠MBP =∠CDP (equal to inscribed angle on the same arc)

So triangular MBP similar to triangular CDP

So the conclusion is to be proven.

Code:

#include <iostream>#include<cstdio>#include<cstdlib>#include<cmath>#include<cstring>#include<algorithm>#include<Set>#include<map>#include<queue>#include<string>#defineLL Long Longusing namespacestd;Const DoublePI = ACOs (-1); inlineDoubleDisDoubleXaDoubleYA,DoubleXB,DoubleYB) {    DoubleAns = (XA-XB) * (XA-XB) + (YA-YB) * (ya-YB); returnsqrt (ans);}voidWork () {DoubleXA, YA, XB, YB, XC, YC; DoubleA, H, D, ans, V, R; scanf ("%LF%LF%LF%LF%LF%LF", &xa, &ya, &AMP;XB, &yb, &AMP;XC, &YC); D= Dis (XB, YB, XC, YC)/2; H=dis (XA, YA, XB, YB); A= ASIN (d/h); V= pi-2*A; R= h*Tan (a); Ans= sqrt (h*h-d*d) +v*R; printf ("%.4lf\n", ans);}intMain () {//freopen ("test.in", "R", stdin);    intT; scanf ("%d", &T);  for(intTimes =1; Times <= T; ++Times ) {printf ("Case #%d:", times);    Work (); }    return 0;}

ACM Learning process-hdu5476 Explore track of point (plane geometry) (2015 Shanghai online game 09)

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.