How to determine type of conic section from coefficient?

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

• I am removing the "algebraic-geometry" tag here. "algebraic-geometry" is the study of zeros of multivariate polynomials, and is different than analytic geometry, which this problem does concern. – Mark Fischler Oct 28 '16 at 20:58
• Sorry, I was a little confused about that one. – Zach Hilman Oct 28 '16 at 20:58
• I mean, this is fundamentally asking about classifying affine varieties given by the general form above. I see no reason why it couldn't be considered part of algebraic geometry (although another tag may indeed be more appropriate). – Michael Lee Oct 28 '16 at 21:02
• Have a look at (math.stackexchange.com/q/1539317) – Jean Marie Oct 28 '16 at 21:19
• This en.m.wikipedia.org/wiki/Conic_section#Discriminant has a formulation in terms of only the coefficients and the determinant $\delta=B^2-4AC$ – Sophie Dec 14 '16 at 3:53