Parabolas

Problem #27

Tags: geometry

Who solved this?

Previous:Scalar Projection Next:Parabolic Osculating Circles


If you have taken a high-school level geometry course, then you have probably encountered the concept of Parabolas. It is likely that you were taught this information while learning about 2nd-degree polynomials and quadratic functions. That is, taking plotting some function of the form f(x) = ax^2 + bx + c will yield a parabola.

However, the actual geometric definition of a parabola may be unexpected or surprising if you have only ever viewed them as plotted polynomials. First select any focus point F, and then also some line D called the directrix. The parabola is formed by the set (or locus) of all points which are equidistant to both the focus and the directrix.

Ellipse Animation

Note the pink lines indicating that any point on the parabola is equidistant both from the focus and from the directrix.

Problem Statement

Given the (x, y) coordinates of a focus point (fx, fy) and the equation of a horizontal directrix given by the equation y = dy, find the 2nd-degree polynomial which corresponds to the parabola defined.

Input Data First line will be Q, the quantity of testcases.
Q lines will then follow, each with three space-separated values fx fy dy.

Answer
The answer to each testcase should consist of 3 space-separated values a b c, corresponding to the 2nd-degree polynomial in the form f(x) = ax^2 + bx + c.
Full answer should consist of 3 * Q space-separated values total.
Error should be less than 1e-6.

Example

input data:
2
0 1 0
9.876 9.765 9.654

answer:
0.5 0 0.5 4.504505 -88.972973 449.058041
You need to login to get test data and submit solution.