How to determine type of conic section from coefficient?

543 Views Asked by At

I am writing a piece of software involving conic sections. I need to write a method that returns a different number (0, 1, 2...) for each type of conic section.

I have determined the following conic sections:

  • 0 - Circle
  • 1 - Ellipse
  • 2 - Parabola
  • 3 - Hyperbola
  • 4 - Rectangular Hyperbola

and these degenerate conics:

  • 5 - Line
  • 6 - Point
  • 7 - Intersecting Lines
  • 8 - Parallel Lines
  • 9 - No Graph

My Question: How to determine which of these ten types a given conic section is using only the values of A, B, C, D, E, and F in the equation below:

$$ Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0 $$

Thanks in advance for any help, Zach Hilman