| home | contents | send comment | send link | add bookmark |

General Conic Equation from five points

by Stephen R. Schmitt

enter five points
xy
change scale factor (optional)

general conic equation given five points:
·x2 + ·x·y + ·y2 + ·x + ·y + = 0


Contents

  1. About
  2. The source code
  3. Discussion

1. About

This Java Script calculator finds the general conic equation corresponding to five points in the Cartesian (x-y) plane. Press the Compute button to obtain the solution. The Test button loads a test case to demonstrate how the calculator works. On invalid entries, a popup window will display an error message.

Return to Contents


2. The source code

The Java Script source code for this program can be viewed by using the View|Source command of your web browser.

You may use or modify this source code in any way you find useful, provided that you agree that the author has no warranty, obligations or liability. You must determine the suitability of this source code for your use.

Return to Contents


3. Discussion

The general conic equation

A conic equation represents the intersection of an extended cone and a plane. The general form of the equation of a conic section is:

A·x2 + B·x·y + C·y2 + D·x + E·y + F = 0

An example

The equation below represents an ellipse with axes aligned with the coordinate frame and with its center at the origin.

 x2    y2  
--- + --- = 1
 a2    b2  
This equation can be changed by a translation that moves the center of the ellipse to a point {p, q} by replacing x, y using:
x := x - p
y := y - q  
It can also be changed by a rotation by angle θ around the coordinate origin by again replacing x, y using:
x :=  x·cos(θ) + y·sin(θ)
y := -x·sin(θ) + y·cos(θ)  
If the ellipse is translated or rotated or both, the resulting equation will have terms in x2, x·y, y2, x, y, and a constant. Transformation of the normal equations for a parabola or a hyperbola would also produce a new equation with these terms.

Fitting a conic section through five points

The general conic section has five independent coefficients (the equation can be divided by any of the six coefficients without changing the equality). Therefore, five points are necessary and sufficient to define a unique conic section. One and only one conic section can be drawn through five points.

One method to determine the five coefficients is to substitute each of the {x, y} points into the equation to obtain five linear equations using five independent coefficients as variables. For example, to find the conic section that fits these five points:

{0.5, 8.0}, {1.0, 4.0}, {2.0, 2.0}, {4.0, 1.0}, {8.0, 0.5}
Solve the system of equations (and arbitrarily choosing F = 4):
 0.25·A + 4.00·B + 64.00·C + 0.50·D + 8.00·E + 4.00 = 0
 1.00·A + 4.00·B + 16.00·C + 1.00·D + 4.00·E + 4.00 = 0
 4.00·A + 4.00·B +  4.00·C + 2.00·D + 2.00·E + 4.00 = 0
16.00·A + 4.00·B +  1.00·C + 4.00·D + 1.00·E + 4.00 = 0
64.00·A + 4.00·B +  0.25·C + 8.00·D + 0.50·E + 4.00 = 0
to obtain the solution:
 - x·y + 4.0000 = 0
The calculator performs these computations using Gaussian elimination.

Reference

Elementary Mathematical Analysis

Return to Contents


AbCd Classics - free on-line books


Copyright © 2004, Stephen R. Schmitt