If a conic $ax^2+by^2+2hxy+2gx+2fy+c=0$ and say:
How to find the eccentricity and the semi-axes of this conic. I do understand that if its a hyperbola only one of the semi axes will be real.
Soham
If a conic $ax^2+by^2+2hxy+2gx+2fy+c=0$ and say:
How to find the eccentricity and the semi-axes of this conic. I do understand that if its a hyperbola only one of the semi axes will be real.
Soham
So the eccentricity of a general conic $ax^2+by^2+2hxy+2gx+2fy+c=0$
$$(h^2 - ab)*(e^2 - 2)^2=(e^2 -1)(a+b)^2$$
For finding the semi major axis partially differentiate the given conic equation with respect to x and y.
This would yield two linear equations in x and y whose solution will give you the centre of the conic.
Find focus and obtain the equation of the semi major axis.
Take $$F(x,y) = ax^2+by^2+2hxy+2gx+2fy+c \tag{1}$$ and find the center of conic
$$ {\rm solve}( \begin{Bmatrix} \tfrac{\partial}{\partial x}F(x,y) & =0 \\ \tfrac{\partial}{\partial y}F(x,y) & = 0 \end{Bmatrix},\;{\rm for}\;\pmatrix{x\\y}) $$
$$ \begin{aligned} x_c & = \frac{g h - b g}{a b - h^2} \\ y_c & = \frac{g h - a f}{a b - h^2} \end{aligned} \tag{2}$$
Now you can decompose each position on the conic, as an offset by $(x_c,y_c)$ and a rotation $\theta$
$$\pmatrix{x \\ y} = \pmatrix{ \frac{g h - b g}{a b - h^2} \\ \frac{g h - a f}{a b - h^2} } + \begin{bmatrix} \cos \theta & \mbox{-}\sin \theta \\ \sin \theta & \cos \theta \end{bmatrix} \pmatrix{u\\v} \tag{3}$$
where $(u,v)$ and two new conic curve coordinates that are centered and axis aligned.
Substitute (2) into (1) to get $G(u,v)$ and set $$ \frac{\partial}{\partial v} \frac{\partial}{\partial u} G(u,v) = 0 \tag{4}$$ in order to find the angle $\theta$ that makes $(u,v)$ axis-aligned.
$$ {\rm solve}(\begin{Bmatrix} 2 h \cos^2 \theta + (b-a) \sin \theta \cos \theta = h \end{Bmatrix} ,\;{\rm for}\; \theta) $$
$$ \theta = \tfrac{1}{2} {\rm atan} \left( \frac{2 g}{a -b} \right) \tag{5}$$
This is the orientation angle of the conic.
Now use $\theta$ in $G(u,v)$ and notice is has the form:
$$ \left( \dots \right) u^2 + \left( \dots \right) v^2 + \left(\dots \right) = 0 $$
But to get the major radius of curvature $A$ and the minor radius of curvature $B$ we need to bring it into the following canonical form
$$ \frac{v^2}{2 A} + \frac{u^2}{2 B} = 1 \tag{6} $$
This is done with
$$ \begin{aligned} \frac{1}{A} & = \frac{ (h^2-a b) \left( (a+b) + \sqrt{ \left( a -b\right)^2 + 4 h^2} \right)} { a b c + \left( 2 f g h - c h^2 - a f^2 -b g^2\right)} \\ \frac{1}{B} & = \frac{ (h^2-a b) \left( (a+b) - \sqrt{ \left( a -b\right)^2 + 4 h^2} \right)} { a b c + \left( 2 f g h - c h^2 - a f^2 -b g^2\right)} \\ \end{aligned} \tag{7}$$
Note that eccentricity is calculated from
$$ \epsilon ^2 = 1 - \frac{B}{A} \tag{8}$$
and the distinction between different conic curves comes from $\epsilon$.
Note that for an ellipse which has $0 < \epsilon < 1 $ the semi-major axis is ${\rm major} = \sqrt{2 A}$ and the semi-minor axis is ${\rm minor} = \sqrt{2 B}$.
But for a hyperbola either $A$ or $B$ are negative, so a different definition is needed for the semi-major or minor axis.
You can transform $(u,v)$ to polar coordinates to get
$$ r(\varphi) = \sqrt{ \frac{ 2 A B}{A - ( A - B) \cos^2 \varphi} } \tag{9}$$
which gives the limits for the distance from the center as $r(\varphi=0) = \sqrt{2 A}$ and $r( \varphi = \pi/2) = \sqrt{ 2 B}$