# Calculating tangent on ellipse

I want to calculate the slope of the tangent at one point of an ellipse whose centre is shifted towards the coordinates $(x_c;y_c)$ and also rotated by an angle $\alpha$ around its centre. Now, I have already found the tangent formula for a simple ellipse without shift and rotation (from Wikipedia). $$\frac{x\cdot x_1}{a^2}+\frac{y\cdot y_1}{b^2} = 1 \iff y = b^2\frac{a^2-x\cdot x_1}{a^2\cdot y_1}$$

where $(x_1;y_1)$ are the coordinates of the point on the ellipse (which I have already calculated) and $a$ and $b$ are the two semi-axis of the ellipse.

Now I was thinking about how I may use this formula for my case. What I came up with is:

• Calculate two points on the non-transformed tangent (that I get from the formula above).
• Rotate both points by the ellipse-angle around $(0,0)$
• Shift both points by $(x_c;y_c)$
• Draw a new tangent through the two transformed points.

Is this a valid way to do it or do I have to do the whole derivation of the tangent formula for the more complex ellipse equation?

• Do you just want the slope or do you also want the formula for the tangent line itself? If you just want the slope: shifting the center of the ellipse does not change the slope. You started with a line of slope $$m = - (b^2 a_1)/(a^2 y_1)$$ this line forms an angle $\theta = \tan^{-1} m$ with the $x$ axis. Rotating with an angle $\alpha$ makes the new tangent line at an angle $\theta + \alpha$ from the $x$ axis. Thus the slope is $\tan(\theta + \alpha)$. You finish by using the tangent addition formula. – Willie Wong May 14 '14 at 15:33
• Therefore the new slope is $$\tan(\theta + \alpha) = \frac{\tan \theta + \tan\alpha}{1 - \tan\theta\tan\alpha} = \frac{m + \tan\alpha}{1 - m \tan\alpha}$$ – Willie Wong May 14 '14 at 15:34

Ok I made it work myself. Here is how I did it:

Abbreviations i use:

FTE - Fully transformed ellipse (rotated by angle u, shifted by xc on the x-axis and yc on the y-axis) OE - Origin ellipse (not rotated, not shifted, meaning its center is at 0|0) TP - Tangent point (point on the ellipse, where tangent and ellipse intersect)

• First calculate the intersection points between the FTE and the straight line (optional, any point on the ellipse will do, it's just related to my problem)
• Translate the chosen TP by -xc and -yc (move the ellipse to the origin)
• Rotate the moved TP by -u (rotate the ellipse backwards to be parallel to the axes)
• The tangent formula for the OE is $$y = b^2\frac{a^2-x\cdot x_1}{a^2\cdot y_1}$$
• Plug in the transformed coordinates for the TP as x1 and y1
• Choose two arbitrary x values and calculate the corresponding y values with this formula
• You have two points on the tangent now (two points define a straight)
• Now rotate both points by u
• Translate both points by xc, yc

The two points now define the tangent to the FTE at the original TP. You can get the straight line equation using

$$m=\frac{y1-y2}{x1-x2}, b=y1-m*x1$$.

The order of the transformations are important. For the transformation of FTE to OE first translate then rotate and for the back transformation first rotate then translate.

Appendix:

Formula for the rotated ellipse:

$$\frac{((x-x_c)*Cos(u)+(y-y_c)*Sin(u))^2}{a^2}+\frac{(-(x-x_c)*Sin(u)+(y-y_c)*Cos(u))^2}{b^2}=1$$

The formulas for finding the intersection between the FTE and the straight line I calculated with Mathematica. They came out very complex. Maybe they can be simplified somehow, but I won't do that since they work for my needs. I would like to ask mods to not modify these with latex. The reason is that in my opinion these should be used as black boxes. Plug values in, get values out. So you can just copy paste these into your project and this is easier in plain-text form.

Variables:

• xc - Ellipse center x
• yc - Ellipse center y
• a - First ellipse radius
• b - Second ellipse radius
• alpha - Rotation angle of the ellipse (called u above)
• m - Slope of straight line
• c - Intercept of straight line

• xg1, yg1 - Coordinates of first intersection point

• xg2, yg2 - Coordinates of second intersection point

xg1

xg1 = (2 * a ^ 2 * c * m * Cos(alpha) ^ 2 - 2 * b ^ 2 * xc * Cos(alpha) ^ 2 - 2 * a ^ 2 * m * yc * Cos(alpha) ^ 2 - 2 * a ^ 2 * c * Cos(alpha) * Sin(alpha) + 2 * b ^ 2 * c * Cos(alpha) * Sin(alpha) + 2 * a ^ 2 * m * xc * Cos(alpha) * Sin(alpha) -
2 * b ^ 2 * m * xc * Cos(alpha) * Sin(alpha) + 2 * a ^ 2 * yc * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * yc * Cos(alpha) * Sin(alpha) + 2 * b ^ 2 * c * m * Sin(alpha) ^ 2 - 2 * a ^ 2 * xc * Sin(alpha) ^ 2 - 2 * b ^ 2 * m * yc * Sin(alpha) ^ 2 -
Sqrt((-2 * a ^ 2 * c * m * Cos(alpha) ^ 2 + 2 * b ^ 2 * xc * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * yc * Cos(alpha) ^ 2 + 2 * a ^ 2 * c * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * c * Cos(alpha) * Sin(alpha) - 2 * a ^ 2 * m * xc * Cos(alpha) * Sin(alpha) +
2 * b ^ 2 * m * xc * Cos(alpha) * Sin(alpha) - 2 * a ^ 2 * yc * Cos(alpha) * Sin(alpha) + 2 * b ^ 2 * yc * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * c * m * Sin(alpha) ^ 2 + 2 * a ^ 2 * xc * Sin(alpha) ^ 2 + 2 * b ^ 2 * m * yc * Sin(alpha) ^ 2) ^ 2 -
4 * ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) *
(a ^ 2 * b ^ 2 - a ^ 2 * c ^ 2 * Cos(alpha) ^ 2 - b ^ 2 * xc ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * c * yc * Cos(alpha) ^ 2 - a ^ 2 * yc ^ 2 * Cos(alpha) ^ 2 - 2 * a ^ 2 * c * xc * Cos(alpha) * Sin(alpha) + 2 * b ^ 2 * c * xc * Cos(alpha) * Sin(alpha) +
2 * a ^ 2 * xc * yc * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * xc * yc * Cos(alpha) * Sin(alpha) - b ^ 2 * c ^ 2 * Sin(alpha) ^ 2 - a ^ 2 * xc ^ 2 * Sin(alpha) ^ 2 + 2 * b ^ 2 * c * yc * Sin(alpha) ^ 2 - b ^ 2 * yc ^ 2 * Sin(alpha) ^ 2))) /
(2 * ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2))


yg1

yg1 = c + (a ^ 2 * c * m ^ 2 * Cos(alpha) ^ 2) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) -
(b ^ 2 * m * xc * Cos(alpha) ^ 2) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) -
(a ^ 2 * m ^ 2 * yc * Cos(alpha) ^ 2) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) -
(a ^ 2 * c * m * Cos(alpha) * Sin(alpha)) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) +
(b ^ 2 * c * m * Cos(alpha) * Sin(alpha)) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) +
(a ^ 2 * m ^ 2 * xc * Cos(alpha) * Sin(alpha)) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) -
(b ^ 2 * m ^ 2 * xc * Cos(alpha) * Sin(alpha)) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) +
(a ^ 2 * m * yc * Cos(alpha) * Sin(alpha)) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) -
(b ^ 2 * m * yc * Cos(alpha) * Sin(alpha)) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) +
(b ^ 2 * c * m ^ 2 * Sin(alpha) ^ 2) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) -
(a ^ 2 * m * xc * Sin(alpha) ^ 2) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) -
(b ^ 2 * m ^ 2 * yc * Sin(alpha) ^ 2) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) -
(m * Sqrt((-2 * a ^ 2 * c * m * Cos(alpha) ^ 2 + 2 * b ^ 2 * xc * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * yc * Cos(alpha) ^ 2 + 2 * a ^ 2 * c * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * c * Cos(alpha) * Sin(alpha) - 2 * a ^ 2 * m * xc * Cos(alpha) * Sin(alpha) +
2 * b ^ 2 * m * xc * Cos(alpha) * Sin(alpha) - 2 * a ^ 2 * yc * Cos(alpha) * Sin(alpha) + 2 * b ^ 2 * yc * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * c * m * Sin(alpha) ^ 2 + 2 * a ^ 2 * xc * Sin(alpha) ^ 2 + 2 * b ^ 2 * m * yc * Sin(alpha) ^ 2) ^ 2 -
4 * ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) *
(a ^ 2 * b ^ 2 - a ^ 2 * c ^ 2 * Cos(alpha) ^ 2 - b ^ 2 * xc ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * c * yc * Cos(alpha) ^ 2 - a ^ 2 * yc ^ 2 * Cos(alpha) ^ 2 - 2 * a ^ 2 * c * xc * Cos(alpha) * Sin(alpha) + 2 * b ^ 2 * c * xc * Cos(alpha) * Sin(alpha) +
2 * a ^ 2 * xc * yc * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * xc * yc * Cos(alpha) * Sin(alpha) - b ^ 2 * c ^ 2 * Sin(alpha) ^ 2 - a ^ 2 * xc ^ 2 * Sin(alpha) ^ 2 + 2 * b ^ 2 * c * yc * Sin(alpha) ^ 2 - b ^ 2 * yc ^ 2 * Sin(alpha) ^ 2))) /
(2 * ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2))


xg2

xg2 = (2 * a ^ 2 * c * m * Cos(alpha) ^ 2 - 2 * b ^ 2 * xc * Cos(alpha) ^ 2 - 2 * a ^ 2 * m * yc * Cos(alpha) ^ 2 - 2 * a ^ 2 * c * Cos(alpha) * Sin(alpha) + 2 * b ^ 2 * c * Cos(alpha) * Sin(alpha) + 2 * a ^ 2 * m * xc * Cos(alpha) * Sin(alpha) -
2 * b ^ 2 * m * xc * Cos(alpha) * Sin(alpha) + 2 * a ^ 2 * yc * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * yc * Cos(alpha) * Sin(alpha) + 2 * b ^ 2 * c * m * Sin(alpha) ^ 2 - 2 * a ^ 2 * xc * Sin(alpha) ^ 2 - 2 * b ^ 2 * m * yc * Sin(alpha) ^ 2 +
Sqrt((-2 * a ^ 2 * c * m * Cos(alpha) ^ 2 + 2 * b ^ 2 * xc * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * yc * Cos(alpha) ^ 2 + 2 * a ^ 2 * c * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * c * Cos(alpha) * Sin(alpha) - 2 * a ^ 2 * m * xc * Cos(alpha) * Sin(alpha) +
2 * b ^ 2 * m * xc * Cos(alpha) * Sin(alpha) - 2 * a ^ 2 * yc * Cos(alpha) * Sin(alpha) + 2 * b ^ 2 * yc * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * c * m * Sin(alpha) ^ 2 + 2 * a ^ 2 * xc * Sin(alpha) ^ 2 + 2 * b ^ 2 * m * yc * Sin(alpha) ^ 2) ^ 2 -
4 * ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) *
(a ^ 2 * b ^ 2 - a ^ 2 * c ^ 2 * Cos(alpha) ^ 2 - b ^ 2 * xc ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * c * yc * Cos(alpha) ^ 2 - a ^ 2 * yc ^ 2 * Cos(alpha) ^ 2 - 2 * a ^ 2 * c * xc * Cos(alpha) * Sin(alpha) + 2 * b ^ 2 * c * xc * Cos(alpha) * Sin(alpha) +
2 * a ^ 2 * xc * yc * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * xc * yc * Cos(alpha) * Sin(alpha) - b ^ 2 * c ^ 2 * Sin(alpha) ^ 2 - a ^ 2 * xc ^ 2 * Sin(alpha) ^ 2 + 2 * b ^ 2 * c * yc * Sin(alpha) ^ 2 - b ^ 2 * yc ^ 2 * Sin(alpha) ^ 2))) /
(2 * ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2))


yg2

            yg2 = c + (a ^ 2 * c * m ^ 2 * Cos(alpha) ^ 2) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) -
(b ^ 2 * m * xc * Cos(alpha) ^ 2) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) -
(a ^ 2 * m ^ 2 * yc * Cos(alpha) ^ 2) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) -
(a ^ 2 * c * m * Cos(alpha) * Sin(alpha)) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) +
(b ^ 2 * c * m * Cos(alpha) * Sin(alpha)) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) +
(a ^ 2 * m ^ 2 * xc * Cos(alpha) * Sin(alpha)) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) -
(b ^ 2 * m ^ 2 * xc * Cos(alpha) * Sin(alpha)) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) +
(a ^ 2 * m * yc * Cos(alpha) * Sin(alpha)) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) -
(b ^ 2 * m * yc * Cos(alpha) * Sin(alpha)) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) +
(b ^ 2 * c * m ^ 2 * Sin(alpha) ^ 2) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) -
(a ^ 2 * m * xc * Sin(alpha) ^ 2) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) -
(b ^ 2 * m ^ 2 * yc * Sin(alpha) ^ 2) / ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) +
(m * Sqrt((-2 * a ^ 2 * c * m * Cos(alpha) ^ 2 + 2 * b ^ 2 * xc * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * yc * Cos(alpha) ^ 2 + 2 * a ^ 2 * c * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * c * Cos(alpha) * Sin(alpha) - 2 * a ^ 2 * m * xc * Cos(alpha) * Sin(alpha) +
2 * b ^ 2 * m * xc * Cos(alpha) * Sin(alpha) - 2 * a ^ 2 * yc * Cos(alpha) * Sin(alpha) + 2 * b ^ 2 * yc * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * c * m * Sin(alpha) ^ 2 + 2 * a ^ 2 * xc * Sin(alpha) ^ 2 + 2 * b ^ 2 * m * yc * Sin(alpha) ^ 2) ^ 2 -
4 * ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2) *
(a ^ 2 * b ^ 2 - a ^ 2 * c ^ 2 * Cos(alpha) ^ 2 - b ^ 2 * xc ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * c * yc * Cos(alpha) ^ 2 - a ^ 2 * yc ^ 2 * Cos(alpha) ^ 2 - 2 * a ^ 2 * c * xc * Cos(alpha) * Sin(alpha) + 2 * b ^ 2 * c * xc * Cos(alpha) * Sin(alpha) +
2 * a ^ 2 * xc * yc * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * xc * yc * Cos(alpha) * Sin(alpha) - b ^ 2 * c ^ 2 * Sin(alpha) ^ 2 - a ^ 2 * xc ^ 2 * Sin(alpha) ^ 2 + 2 * b ^ 2 * c * yc * Sin(alpha) ^ 2 - b ^ 2 * yc ^ 2 * Sin(alpha) ^ 2))) /
(2 * ((-b ^ 2) * Cos(alpha) ^ 2 - a ^ 2 * m ^ 2 * Cos(alpha) ^ 2 + 2 * a ^ 2 * m * Cos(alpha) * Sin(alpha) - 2 * b ^ 2 * m * Cos(alpha) * Sin(alpha) - a ^ 2 * Sin(alpha) ^ 2 - b ^ 2 * m ^ 2 * Sin(alpha) ^ 2))