What is the equation for an ellipse in standard form after an arbitrary matrix transformation?












2












$begingroup$


Suppose I have a general ellipse parameterized by a center point $(h, k)$, semimajor axis $a$, semiminor axis $b$, and rotation angle $theta$. This has the formula in standard form of



$frac{((x−h)cos(theta) + (y−k)sin(theta))^2}{a^2} + frac{((x−h)sin(theta) + (y−k)cos(theta))^2}{b^2} = 1$



Now, I want to apply an affine transformation in homogenous coordinates given by a general transformation matrix



$left[matrix{a & b & ecr c & d & fcr 0 & 0 & 1}right]$



How do get to the transformed parameterization of the ellipse in the new coordinate system given by $(hprime, kprime)$, $aprime$, $bprime$, and $thetaprime$?



I can algebraically transform that initial representation into general form resulting in



$A = frac{cos(theta)}{a}^2+frac{sin(theta)}{b}^2$



$B = 2cos(theta)sin(theta)(frac{1}{a}^2 - frac{1}{b}^2)$



$C = frac{sin(theta)}{a}^2+frac{cos(theta)}{b}^2$



$D = 2Ah+Bk$



$E = 2Ck+Bh$



$F = Ah^2 + Bhk + Ck^2 - 1$



from whence I can get the equation of the ellipse in matrix form... but I'm not really sure where to go from there, or if that's even the right direction to start in.



I attempted a short-cut calculating the transformed center and vertex points, and then calculating the distance from the transformed vertices to the transformed center to get the semimajor and semiminor axes, and arctangent between one of the transformed vertices and transformed center to get the value for $theta$, but for some reason that does not appear to produce correct results.










share|cite|improve this question









$endgroup$












  • $begingroup$
    Invert the transformation and substitute, or equivalently use $C'=M^{-T}CM^{-1}$. If you want the new axes, &c, I don’t know of any shortcuts—a general affine transformation only preserves conjugacy of diameters.
    $endgroup$
    – amd
    Jan 16 at 22:46












  • $begingroup$
    @amd That's a little too abstract for me to wrap my head around. Invert the transformation--cool, I can do that. But... substitute what, into where? And what does $C$ mean in your equation? If I can get a transformed equation in general or standard form, I can algebra my way back to the preferred parameterization.
    $endgroup$
    – Logan R. Kearsley
    Jan 16 at 23:43










  • $begingroup$
    Substitute into the equation of the ellipse, just as you might when performing a transformation of any equation. The $C$ in my hint is the matrix of the conic, which from your question a gather you know how to form.
    $endgroup$
    – amd
    Jan 17 at 0:25












  • $begingroup$
    @amd Ah! I see. I was confused because $C$ is also the name for a component of that matrix. So, if I understand correctly, I need to calculate $Qprime = M^{-T}QM^{-1}$, where $Q = left[matrix{A & B/2 & D/2 cr B/2 & C & E/2 cr D/2 & E/2 & F}right]$, and I should end up with $Qprime = left[matrix{Aprime & Bprime/2 & Dprime/2 cr Bprime/2 & Cprime & Eprime/2 cr Dprime/2 & Eprime/2 & Fprime}right]$ And then given those primed coefficient for the general conic equation, I can algebra my way back to the preferred parameterization. Correct?
    $endgroup$
    – Logan R. Kearsley
    Jan 17 at 1:05








  • 1




    $begingroup$
    That’s correct. The center of the transformed ellipse is easy to recover—it’s just the image of the original center—but the principal axes will require some work.
    $endgroup$
    – amd
    Jan 17 at 1:08
















2












$begingroup$


Suppose I have a general ellipse parameterized by a center point $(h, k)$, semimajor axis $a$, semiminor axis $b$, and rotation angle $theta$. This has the formula in standard form of



$frac{((x−h)cos(theta) + (y−k)sin(theta))^2}{a^2} + frac{((x−h)sin(theta) + (y−k)cos(theta))^2}{b^2} = 1$



Now, I want to apply an affine transformation in homogenous coordinates given by a general transformation matrix



$left[matrix{a & b & ecr c & d & fcr 0 & 0 & 1}right]$



How do get to the transformed parameterization of the ellipse in the new coordinate system given by $(hprime, kprime)$, $aprime$, $bprime$, and $thetaprime$?



I can algebraically transform that initial representation into general form resulting in



$A = frac{cos(theta)}{a}^2+frac{sin(theta)}{b}^2$



$B = 2cos(theta)sin(theta)(frac{1}{a}^2 - frac{1}{b}^2)$



$C = frac{sin(theta)}{a}^2+frac{cos(theta)}{b}^2$



$D = 2Ah+Bk$



$E = 2Ck+Bh$



$F = Ah^2 + Bhk + Ck^2 - 1$



from whence I can get the equation of the ellipse in matrix form... but I'm not really sure where to go from there, or if that's even the right direction to start in.



I attempted a short-cut calculating the transformed center and vertex points, and then calculating the distance from the transformed vertices to the transformed center to get the semimajor and semiminor axes, and arctangent between one of the transformed vertices and transformed center to get the value for $theta$, but for some reason that does not appear to produce correct results.










share|cite|improve this question









$endgroup$












  • $begingroup$
    Invert the transformation and substitute, or equivalently use $C'=M^{-T}CM^{-1}$. If you want the new axes, &c, I don’t know of any shortcuts—a general affine transformation only preserves conjugacy of diameters.
    $endgroup$
    – amd
    Jan 16 at 22:46












  • $begingroup$
    @amd That's a little too abstract for me to wrap my head around. Invert the transformation--cool, I can do that. But... substitute what, into where? And what does $C$ mean in your equation? If I can get a transformed equation in general or standard form, I can algebra my way back to the preferred parameterization.
    $endgroup$
    – Logan R. Kearsley
    Jan 16 at 23:43










  • $begingroup$
    Substitute into the equation of the ellipse, just as you might when performing a transformation of any equation. The $C$ in my hint is the matrix of the conic, which from your question a gather you know how to form.
    $endgroup$
    – amd
    Jan 17 at 0:25












  • $begingroup$
    @amd Ah! I see. I was confused because $C$ is also the name for a component of that matrix. So, if I understand correctly, I need to calculate $Qprime = M^{-T}QM^{-1}$, where $Q = left[matrix{A & B/2 & D/2 cr B/2 & C & E/2 cr D/2 & E/2 & F}right]$, and I should end up with $Qprime = left[matrix{Aprime & Bprime/2 & Dprime/2 cr Bprime/2 & Cprime & Eprime/2 cr Dprime/2 & Eprime/2 & Fprime}right]$ And then given those primed coefficient for the general conic equation, I can algebra my way back to the preferred parameterization. Correct?
    $endgroup$
    – Logan R. Kearsley
    Jan 17 at 1:05








  • 1




    $begingroup$
    That’s correct. The center of the transformed ellipse is easy to recover—it’s just the image of the original center—but the principal axes will require some work.
    $endgroup$
    – amd
    Jan 17 at 1:08














2












2








2


0



$begingroup$


Suppose I have a general ellipse parameterized by a center point $(h, k)$, semimajor axis $a$, semiminor axis $b$, and rotation angle $theta$. This has the formula in standard form of



$frac{((x−h)cos(theta) + (y−k)sin(theta))^2}{a^2} + frac{((x−h)sin(theta) + (y−k)cos(theta))^2}{b^2} = 1$



Now, I want to apply an affine transformation in homogenous coordinates given by a general transformation matrix



$left[matrix{a & b & ecr c & d & fcr 0 & 0 & 1}right]$



How do get to the transformed parameterization of the ellipse in the new coordinate system given by $(hprime, kprime)$, $aprime$, $bprime$, and $thetaprime$?



I can algebraically transform that initial representation into general form resulting in



$A = frac{cos(theta)}{a}^2+frac{sin(theta)}{b}^2$



$B = 2cos(theta)sin(theta)(frac{1}{a}^2 - frac{1}{b}^2)$



$C = frac{sin(theta)}{a}^2+frac{cos(theta)}{b}^2$



$D = 2Ah+Bk$



$E = 2Ck+Bh$



$F = Ah^2 + Bhk + Ck^2 - 1$



from whence I can get the equation of the ellipse in matrix form... but I'm not really sure where to go from there, or if that's even the right direction to start in.



I attempted a short-cut calculating the transformed center and vertex points, and then calculating the distance from the transformed vertices to the transformed center to get the semimajor and semiminor axes, and arctangent between one of the transformed vertices and transformed center to get the value for $theta$, but for some reason that does not appear to produce correct results.










share|cite|improve this question









$endgroup$




Suppose I have a general ellipse parameterized by a center point $(h, k)$, semimajor axis $a$, semiminor axis $b$, and rotation angle $theta$. This has the formula in standard form of



$frac{((x−h)cos(theta) + (y−k)sin(theta))^2}{a^2} + frac{((x−h)sin(theta) + (y−k)cos(theta))^2}{b^2} = 1$



Now, I want to apply an affine transformation in homogenous coordinates given by a general transformation matrix



$left[matrix{a & b & ecr c & d & fcr 0 & 0 & 1}right]$



How do get to the transformed parameterization of the ellipse in the new coordinate system given by $(hprime, kprime)$, $aprime$, $bprime$, and $thetaprime$?



I can algebraically transform that initial representation into general form resulting in



$A = frac{cos(theta)}{a}^2+frac{sin(theta)}{b}^2$



$B = 2cos(theta)sin(theta)(frac{1}{a}^2 - frac{1}{b}^2)$



$C = frac{sin(theta)}{a}^2+frac{cos(theta)}{b}^2$



$D = 2Ah+Bk$



$E = 2Ck+Bh$



$F = Ah^2 + Bhk + Ck^2 - 1$



from whence I can get the equation of the ellipse in matrix form... but I'm not really sure where to go from there, or if that's even the right direction to start in.



I attempted a short-cut calculating the transformed center and vertex points, and then calculating the distance from the transformed vertices to the transformed center to get the semimajor and semiminor axes, and arctangent between one of the transformed vertices and transformed center to get the value for $theta$, but for some reason that does not appear to produce correct results.







linear-algebra linear-transformations conic-sections computational-geometry






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Jan 16 at 21:24









Logan R. KearsleyLogan R. Kearsley

1604




1604












  • $begingroup$
    Invert the transformation and substitute, or equivalently use $C'=M^{-T}CM^{-1}$. If you want the new axes, &c, I don’t know of any shortcuts—a general affine transformation only preserves conjugacy of diameters.
    $endgroup$
    – amd
    Jan 16 at 22:46












  • $begingroup$
    @amd That's a little too abstract for me to wrap my head around. Invert the transformation--cool, I can do that. But... substitute what, into where? And what does $C$ mean in your equation? If I can get a transformed equation in general or standard form, I can algebra my way back to the preferred parameterization.
    $endgroup$
    – Logan R. Kearsley
    Jan 16 at 23:43










  • $begingroup$
    Substitute into the equation of the ellipse, just as you might when performing a transformation of any equation. The $C$ in my hint is the matrix of the conic, which from your question a gather you know how to form.
    $endgroup$
    – amd
    Jan 17 at 0:25












  • $begingroup$
    @amd Ah! I see. I was confused because $C$ is also the name for a component of that matrix. So, if I understand correctly, I need to calculate $Qprime = M^{-T}QM^{-1}$, where $Q = left[matrix{A & B/2 & D/2 cr B/2 & C & E/2 cr D/2 & E/2 & F}right]$, and I should end up with $Qprime = left[matrix{Aprime & Bprime/2 & Dprime/2 cr Bprime/2 & Cprime & Eprime/2 cr Dprime/2 & Eprime/2 & Fprime}right]$ And then given those primed coefficient for the general conic equation, I can algebra my way back to the preferred parameterization. Correct?
    $endgroup$
    – Logan R. Kearsley
    Jan 17 at 1:05








  • 1




    $begingroup$
    That’s correct. The center of the transformed ellipse is easy to recover—it’s just the image of the original center—but the principal axes will require some work.
    $endgroup$
    – amd
    Jan 17 at 1:08


















  • $begingroup$
    Invert the transformation and substitute, or equivalently use $C'=M^{-T}CM^{-1}$. If you want the new axes, &c, I don’t know of any shortcuts—a general affine transformation only preserves conjugacy of diameters.
    $endgroup$
    – amd
    Jan 16 at 22:46












  • $begingroup$
    @amd That's a little too abstract for me to wrap my head around. Invert the transformation--cool, I can do that. But... substitute what, into where? And what does $C$ mean in your equation? If I can get a transformed equation in general or standard form, I can algebra my way back to the preferred parameterization.
    $endgroup$
    – Logan R. Kearsley
    Jan 16 at 23:43










  • $begingroup$
    Substitute into the equation of the ellipse, just as you might when performing a transformation of any equation. The $C$ in my hint is the matrix of the conic, which from your question a gather you know how to form.
    $endgroup$
    – amd
    Jan 17 at 0:25












  • $begingroup$
    @amd Ah! I see. I was confused because $C$ is also the name for a component of that matrix. So, if I understand correctly, I need to calculate $Qprime = M^{-T}QM^{-1}$, where $Q = left[matrix{A & B/2 & D/2 cr B/2 & C & E/2 cr D/2 & E/2 & F}right]$, and I should end up with $Qprime = left[matrix{Aprime & Bprime/2 & Dprime/2 cr Bprime/2 & Cprime & Eprime/2 cr Dprime/2 & Eprime/2 & Fprime}right]$ And then given those primed coefficient for the general conic equation, I can algebra my way back to the preferred parameterization. Correct?
    $endgroup$
    – Logan R. Kearsley
    Jan 17 at 1:05








  • 1




    $begingroup$
    That’s correct. The center of the transformed ellipse is easy to recover—it’s just the image of the original center—but the principal axes will require some work.
    $endgroup$
    – amd
    Jan 17 at 1:08
















$begingroup$
Invert the transformation and substitute, or equivalently use $C'=M^{-T}CM^{-1}$. If you want the new axes, &c, I don’t know of any shortcuts—a general affine transformation only preserves conjugacy of diameters.
$endgroup$
– amd
Jan 16 at 22:46






$begingroup$
Invert the transformation and substitute, or equivalently use $C'=M^{-T}CM^{-1}$. If you want the new axes, &c, I don’t know of any shortcuts—a general affine transformation only preserves conjugacy of diameters.
$endgroup$
– amd
Jan 16 at 22:46














$begingroup$
@amd That's a little too abstract for me to wrap my head around. Invert the transformation--cool, I can do that. But... substitute what, into where? And what does $C$ mean in your equation? If I can get a transformed equation in general or standard form, I can algebra my way back to the preferred parameterization.
$endgroup$
– Logan R. Kearsley
Jan 16 at 23:43




$begingroup$
@amd That's a little too abstract for me to wrap my head around. Invert the transformation--cool, I can do that. But... substitute what, into where? And what does $C$ mean in your equation? If I can get a transformed equation in general or standard form, I can algebra my way back to the preferred parameterization.
$endgroup$
– Logan R. Kearsley
Jan 16 at 23:43












$begingroup$
Substitute into the equation of the ellipse, just as you might when performing a transformation of any equation. The $C$ in my hint is the matrix of the conic, which from your question a gather you know how to form.
$endgroup$
– amd
Jan 17 at 0:25






$begingroup$
Substitute into the equation of the ellipse, just as you might when performing a transformation of any equation. The $C$ in my hint is the matrix of the conic, which from your question a gather you know how to form.
$endgroup$
– amd
Jan 17 at 0:25














$begingroup$
@amd Ah! I see. I was confused because $C$ is also the name for a component of that matrix. So, if I understand correctly, I need to calculate $Qprime = M^{-T}QM^{-1}$, where $Q = left[matrix{A & B/2 & D/2 cr B/2 & C & E/2 cr D/2 & E/2 & F}right]$, and I should end up with $Qprime = left[matrix{Aprime & Bprime/2 & Dprime/2 cr Bprime/2 & Cprime & Eprime/2 cr Dprime/2 & Eprime/2 & Fprime}right]$ And then given those primed coefficient for the general conic equation, I can algebra my way back to the preferred parameterization. Correct?
$endgroup$
– Logan R. Kearsley
Jan 17 at 1:05






$begingroup$
@amd Ah! I see. I was confused because $C$ is also the name for a component of that matrix. So, if I understand correctly, I need to calculate $Qprime = M^{-T}QM^{-1}$, where $Q = left[matrix{A & B/2 & D/2 cr B/2 & C & E/2 cr D/2 & E/2 & F}right]$, and I should end up with $Qprime = left[matrix{Aprime & Bprime/2 & Dprime/2 cr Bprime/2 & Cprime & Eprime/2 cr Dprime/2 & Eprime/2 & Fprime}right]$ And then given those primed coefficient for the general conic equation, I can algebra my way back to the preferred parameterization. Correct?
$endgroup$
– Logan R. Kearsley
Jan 17 at 1:05






1




1




$begingroup$
That’s correct. The center of the transformed ellipse is easy to recover—it’s just the image of the original center—but the principal axes will require some work.
$endgroup$
– amd
Jan 17 at 1:08




$begingroup$
That’s correct. The center of the transformed ellipse is easy to recover—it’s just the image of the original center—but the principal axes will require some work.
$endgroup$
– amd
Jan 17 at 1:08










1 Answer
1






active

oldest

votes


















1












$begingroup$

[Transferring the discussion in comments to an answer.]



Under a general affine transformation, the image of the center of an ellipse is the center of the ellipse’s image, so that’s easily computed. Unfortunately, the principal axes aren’t usually mapped to the axes of the image, although their images are conjugate diameters of the resulting ellipse. There are a couple of approaches that you might take to determine the semiaxis lengths and rotation angle of the image.



Writing the general conic equation $Ax^2+Bxy+Cy^2+Dx+Ey+F=0$ in matrix form $$mathbf x^TQmathbf x = begin{bmatrix}x&y&1end{bmatrix} begin{bmatrix}A&frac B2&frac D2\frac B2&C&frac E2\frac D2&frac E2&Fend{bmatrix} begin{bmatrix}x\y\1end{bmatrix} =0, tag1$$ under the point transformation $mathbf x' = Mmathbf x$ the matrix $Q$ transforms into $M^{-T}QM^{-1}$. (You can easily derive this by substituting for $mathbf x$ in (1) and rearranging.) So, you could compute this transformation, extract the new coefficients of the conic equation from the result, and then use standard methods and formulas to extract the parameters that you’re interested in.



You can save yourself some work by looking only at the quadratic part of the equation: the shape of the ellipse is only affected by the linear part of the transformation, so you need only focus on the ellipse with equation $${(xcostheta+ysintheta)^2over a^2}+{(xsintheta-ycostheta)^2over b^2}=1, tag 2$$ i.e., decompose the affine transformation into the composition of a translation by $(-h,-k)$, a linear transformation, and then another translation. (Note that I’ve corrected the sign error in your original equation.) In matrix form, we have $(x,y)Q(x,y)^T=1$ and the ellipse’s matrix again transforms as $M^{-T}QM^{-1}$, except that now we’re working with $2times2$ matrices. Apply the transformation and extract the rotation and semiaxis lengths from the resulting coefficients.



One could, with a lot of tedious work or assistance of a symbolic algebra program, work out a general formula for the resulting parameters, but it’s going to be very ugly. If you’re planning to code this, it’s probably best to take it step-by-step instead of trying to transcribe some complex formula.



There are a couple of alternative approaches that might be interesting, though they don’t lead to simple general formulas, either, and might not be any less work than the above. First notice that you can parameterize your original ellipse as $mathbf c + mathbf ucos t + mathbf vsin t$, where $mathbf c = (h,k)$, $mathbf u = a(costheta,sintheta)$ and $mathbf v=b(-sintheta,costheta)$. Focusing again on the linear part of the transformation, the new ellipse is a translate of $mathbf r(t) = Mmathbf ucos t+Mmathbf vsin t$. The tangent to an ellipse at a vertex is orthogonal to the corresponding principal axis, so a way to find these vertices is to solve $mathbf r(t)cdotmathbf r'(t)=0$ for $t$. Unless you ended up with a circle, there will be two pairs of diametrically opposite solutions. The semiaxis lengths are then just the two lengths $|mathbf r(t)|$ and the rotation angle is also easily computed.



Another possible approach takes advantage of the fact that the original ellipse (again after translation back to the origin) is itself obtained from the unit circle by scaling and rotation, so that this ellipse when further transformed is obtained from the unit circle via some composite transformation given by the matrix $M'=MRS$, with $$R = begin{bmatrix}costheta&-sintheta\sintheta&costhetaend{bmatrix} text{ and } S = begin{bmatrix}a&0\0&bend{bmatrix}.$$ The SVD of $M'$ refactors it into the product of a rotation, a diagonal matrix (i.e., scaling along orthogonal directions) and another rotation. The half-axis lengths of the ellipse are therefore given by the central diagonal matrix, and, since the first rotation leaves the unit circle unchanged, the ellipse’s principal axis directions are the columns of the left-hand rotation matrix in the SVD. The rotation angle is easily recovered from them.






share|cite|improve this answer











$endgroup$













    Your Answer





    StackExchange.ifUsing("editor", function () {
    return StackExchange.using("mathjaxEditing", function () {
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    });
    });
    }, "mathjax-editing");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "69"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3076317%2fwhat-is-the-equation-for-an-ellipse-in-standard-form-after-an-arbitrary-matrix-t%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1












    $begingroup$

    [Transferring the discussion in comments to an answer.]



    Under a general affine transformation, the image of the center of an ellipse is the center of the ellipse’s image, so that’s easily computed. Unfortunately, the principal axes aren’t usually mapped to the axes of the image, although their images are conjugate diameters of the resulting ellipse. There are a couple of approaches that you might take to determine the semiaxis lengths and rotation angle of the image.



    Writing the general conic equation $Ax^2+Bxy+Cy^2+Dx+Ey+F=0$ in matrix form $$mathbf x^TQmathbf x = begin{bmatrix}x&y&1end{bmatrix} begin{bmatrix}A&frac B2&frac D2\frac B2&C&frac E2\frac D2&frac E2&Fend{bmatrix} begin{bmatrix}x\y\1end{bmatrix} =0, tag1$$ under the point transformation $mathbf x' = Mmathbf x$ the matrix $Q$ transforms into $M^{-T}QM^{-1}$. (You can easily derive this by substituting for $mathbf x$ in (1) and rearranging.) So, you could compute this transformation, extract the new coefficients of the conic equation from the result, and then use standard methods and formulas to extract the parameters that you’re interested in.



    You can save yourself some work by looking only at the quadratic part of the equation: the shape of the ellipse is only affected by the linear part of the transformation, so you need only focus on the ellipse with equation $${(xcostheta+ysintheta)^2over a^2}+{(xsintheta-ycostheta)^2over b^2}=1, tag 2$$ i.e., decompose the affine transformation into the composition of a translation by $(-h,-k)$, a linear transformation, and then another translation. (Note that I’ve corrected the sign error in your original equation.) In matrix form, we have $(x,y)Q(x,y)^T=1$ and the ellipse’s matrix again transforms as $M^{-T}QM^{-1}$, except that now we’re working with $2times2$ matrices. Apply the transformation and extract the rotation and semiaxis lengths from the resulting coefficients.



    One could, with a lot of tedious work or assistance of a symbolic algebra program, work out a general formula for the resulting parameters, but it’s going to be very ugly. If you’re planning to code this, it’s probably best to take it step-by-step instead of trying to transcribe some complex formula.



    There are a couple of alternative approaches that might be interesting, though they don’t lead to simple general formulas, either, and might not be any less work than the above. First notice that you can parameterize your original ellipse as $mathbf c + mathbf ucos t + mathbf vsin t$, where $mathbf c = (h,k)$, $mathbf u = a(costheta,sintheta)$ and $mathbf v=b(-sintheta,costheta)$. Focusing again on the linear part of the transformation, the new ellipse is a translate of $mathbf r(t) = Mmathbf ucos t+Mmathbf vsin t$. The tangent to an ellipse at a vertex is orthogonal to the corresponding principal axis, so a way to find these vertices is to solve $mathbf r(t)cdotmathbf r'(t)=0$ for $t$. Unless you ended up with a circle, there will be two pairs of diametrically opposite solutions. The semiaxis lengths are then just the two lengths $|mathbf r(t)|$ and the rotation angle is also easily computed.



    Another possible approach takes advantage of the fact that the original ellipse (again after translation back to the origin) is itself obtained from the unit circle by scaling and rotation, so that this ellipse when further transformed is obtained from the unit circle via some composite transformation given by the matrix $M'=MRS$, with $$R = begin{bmatrix}costheta&-sintheta\sintheta&costhetaend{bmatrix} text{ and } S = begin{bmatrix}a&0\0&bend{bmatrix}.$$ The SVD of $M'$ refactors it into the product of a rotation, a diagonal matrix (i.e., scaling along orthogonal directions) and another rotation. The half-axis lengths of the ellipse are therefore given by the central diagonal matrix, and, since the first rotation leaves the unit circle unchanged, the ellipse’s principal axis directions are the columns of the left-hand rotation matrix in the SVD. The rotation angle is easily recovered from them.






    share|cite|improve this answer











    $endgroup$


















      1












      $begingroup$

      [Transferring the discussion in comments to an answer.]



      Under a general affine transformation, the image of the center of an ellipse is the center of the ellipse’s image, so that’s easily computed. Unfortunately, the principal axes aren’t usually mapped to the axes of the image, although their images are conjugate diameters of the resulting ellipse. There are a couple of approaches that you might take to determine the semiaxis lengths and rotation angle of the image.



      Writing the general conic equation $Ax^2+Bxy+Cy^2+Dx+Ey+F=0$ in matrix form $$mathbf x^TQmathbf x = begin{bmatrix}x&y&1end{bmatrix} begin{bmatrix}A&frac B2&frac D2\frac B2&C&frac E2\frac D2&frac E2&Fend{bmatrix} begin{bmatrix}x\y\1end{bmatrix} =0, tag1$$ under the point transformation $mathbf x' = Mmathbf x$ the matrix $Q$ transforms into $M^{-T}QM^{-1}$. (You can easily derive this by substituting for $mathbf x$ in (1) and rearranging.) So, you could compute this transformation, extract the new coefficients of the conic equation from the result, and then use standard methods and formulas to extract the parameters that you’re interested in.



      You can save yourself some work by looking only at the quadratic part of the equation: the shape of the ellipse is only affected by the linear part of the transformation, so you need only focus on the ellipse with equation $${(xcostheta+ysintheta)^2over a^2}+{(xsintheta-ycostheta)^2over b^2}=1, tag 2$$ i.e., decompose the affine transformation into the composition of a translation by $(-h,-k)$, a linear transformation, and then another translation. (Note that I’ve corrected the sign error in your original equation.) In matrix form, we have $(x,y)Q(x,y)^T=1$ and the ellipse’s matrix again transforms as $M^{-T}QM^{-1}$, except that now we’re working with $2times2$ matrices. Apply the transformation and extract the rotation and semiaxis lengths from the resulting coefficients.



      One could, with a lot of tedious work or assistance of a symbolic algebra program, work out a general formula for the resulting parameters, but it’s going to be very ugly. If you’re planning to code this, it’s probably best to take it step-by-step instead of trying to transcribe some complex formula.



      There are a couple of alternative approaches that might be interesting, though they don’t lead to simple general formulas, either, and might not be any less work than the above. First notice that you can parameterize your original ellipse as $mathbf c + mathbf ucos t + mathbf vsin t$, where $mathbf c = (h,k)$, $mathbf u = a(costheta,sintheta)$ and $mathbf v=b(-sintheta,costheta)$. Focusing again on the linear part of the transformation, the new ellipse is a translate of $mathbf r(t) = Mmathbf ucos t+Mmathbf vsin t$. The tangent to an ellipse at a vertex is orthogonal to the corresponding principal axis, so a way to find these vertices is to solve $mathbf r(t)cdotmathbf r'(t)=0$ for $t$. Unless you ended up with a circle, there will be two pairs of diametrically opposite solutions. The semiaxis lengths are then just the two lengths $|mathbf r(t)|$ and the rotation angle is also easily computed.



      Another possible approach takes advantage of the fact that the original ellipse (again after translation back to the origin) is itself obtained from the unit circle by scaling and rotation, so that this ellipse when further transformed is obtained from the unit circle via some composite transformation given by the matrix $M'=MRS$, with $$R = begin{bmatrix}costheta&-sintheta\sintheta&costhetaend{bmatrix} text{ and } S = begin{bmatrix}a&0\0&bend{bmatrix}.$$ The SVD of $M'$ refactors it into the product of a rotation, a diagonal matrix (i.e., scaling along orthogonal directions) and another rotation. The half-axis lengths of the ellipse are therefore given by the central diagonal matrix, and, since the first rotation leaves the unit circle unchanged, the ellipse’s principal axis directions are the columns of the left-hand rotation matrix in the SVD. The rotation angle is easily recovered from them.






      share|cite|improve this answer











      $endgroup$
















        1












        1








        1





        $begingroup$

        [Transferring the discussion in comments to an answer.]



        Under a general affine transformation, the image of the center of an ellipse is the center of the ellipse’s image, so that’s easily computed. Unfortunately, the principal axes aren’t usually mapped to the axes of the image, although their images are conjugate diameters of the resulting ellipse. There are a couple of approaches that you might take to determine the semiaxis lengths and rotation angle of the image.



        Writing the general conic equation $Ax^2+Bxy+Cy^2+Dx+Ey+F=0$ in matrix form $$mathbf x^TQmathbf x = begin{bmatrix}x&y&1end{bmatrix} begin{bmatrix}A&frac B2&frac D2\frac B2&C&frac E2\frac D2&frac E2&Fend{bmatrix} begin{bmatrix}x\y\1end{bmatrix} =0, tag1$$ under the point transformation $mathbf x' = Mmathbf x$ the matrix $Q$ transforms into $M^{-T}QM^{-1}$. (You can easily derive this by substituting for $mathbf x$ in (1) and rearranging.) So, you could compute this transformation, extract the new coefficients of the conic equation from the result, and then use standard methods and formulas to extract the parameters that you’re interested in.



        You can save yourself some work by looking only at the quadratic part of the equation: the shape of the ellipse is only affected by the linear part of the transformation, so you need only focus on the ellipse with equation $${(xcostheta+ysintheta)^2over a^2}+{(xsintheta-ycostheta)^2over b^2}=1, tag 2$$ i.e., decompose the affine transformation into the composition of a translation by $(-h,-k)$, a linear transformation, and then another translation. (Note that I’ve corrected the sign error in your original equation.) In matrix form, we have $(x,y)Q(x,y)^T=1$ and the ellipse’s matrix again transforms as $M^{-T}QM^{-1}$, except that now we’re working with $2times2$ matrices. Apply the transformation and extract the rotation and semiaxis lengths from the resulting coefficients.



        One could, with a lot of tedious work or assistance of a symbolic algebra program, work out a general formula for the resulting parameters, but it’s going to be very ugly. If you’re planning to code this, it’s probably best to take it step-by-step instead of trying to transcribe some complex formula.



        There are a couple of alternative approaches that might be interesting, though they don’t lead to simple general formulas, either, and might not be any less work than the above. First notice that you can parameterize your original ellipse as $mathbf c + mathbf ucos t + mathbf vsin t$, where $mathbf c = (h,k)$, $mathbf u = a(costheta,sintheta)$ and $mathbf v=b(-sintheta,costheta)$. Focusing again on the linear part of the transformation, the new ellipse is a translate of $mathbf r(t) = Mmathbf ucos t+Mmathbf vsin t$. The tangent to an ellipse at a vertex is orthogonal to the corresponding principal axis, so a way to find these vertices is to solve $mathbf r(t)cdotmathbf r'(t)=0$ for $t$. Unless you ended up with a circle, there will be two pairs of diametrically opposite solutions. The semiaxis lengths are then just the two lengths $|mathbf r(t)|$ and the rotation angle is also easily computed.



        Another possible approach takes advantage of the fact that the original ellipse (again after translation back to the origin) is itself obtained from the unit circle by scaling and rotation, so that this ellipse when further transformed is obtained from the unit circle via some composite transformation given by the matrix $M'=MRS$, with $$R = begin{bmatrix}costheta&-sintheta\sintheta&costhetaend{bmatrix} text{ and } S = begin{bmatrix}a&0\0&bend{bmatrix}.$$ The SVD of $M'$ refactors it into the product of a rotation, a diagonal matrix (i.e., scaling along orthogonal directions) and another rotation. The half-axis lengths of the ellipse are therefore given by the central diagonal matrix, and, since the first rotation leaves the unit circle unchanged, the ellipse’s principal axis directions are the columns of the left-hand rotation matrix in the SVD. The rotation angle is easily recovered from them.






        share|cite|improve this answer











        $endgroup$



        [Transferring the discussion in comments to an answer.]



        Under a general affine transformation, the image of the center of an ellipse is the center of the ellipse’s image, so that’s easily computed. Unfortunately, the principal axes aren’t usually mapped to the axes of the image, although their images are conjugate diameters of the resulting ellipse. There are a couple of approaches that you might take to determine the semiaxis lengths and rotation angle of the image.



        Writing the general conic equation $Ax^2+Bxy+Cy^2+Dx+Ey+F=0$ in matrix form $$mathbf x^TQmathbf x = begin{bmatrix}x&y&1end{bmatrix} begin{bmatrix}A&frac B2&frac D2\frac B2&C&frac E2\frac D2&frac E2&Fend{bmatrix} begin{bmatrix}x\y\1end{bmatrix} =0, tag1$$ under the point transformation $mathbf x' = Mmathbf x$ the matrix $Q$ transforms into $M^{-T}QM^{-1}$. (You can easily derive this by substituting for $mathbf x$ in (1) and rearranging.) So, you could compute this transformation, extract the new coefficients of the conic equation from the result, and then use standard methods and formulas to extract the parameters that you’re interested in.



        You can save yourself some work by looking only at the quadratic part of the equation: the shape of the ellipse is only affected by the linear part of the transformation, so you need only focus on the ellipse with equation $${(xcostheta+ysintheta)^2over a^2}+{(xsintheta-ycostheta)^2over b^2}=1, tag 2$$ i.e., decompose the affine transformation into the composition of a translation by $(-h,-k)$, a linear transformation, and then another translation. (Note that I’ve corrected the sign error in your original equation.) In matrix form, we have $(x,y)Q(x,y)^T=1$ and the ellipse’s matrix again transforms as $M^{-T}QM^{-1}$, except that now we’re working with $2times2$ matrices. Apply the transformation and extract the rotation and semiaxis lengths from the resulting coefficients.



        One could, with a lot of tedious work or assistance of a symbolic algebra program, work out a general formula for the resulting parameters, but it’s going to be very ugly. If you’re planning to code this, it’s probably best to take it step-by-step instead of trying to transcribe some complex formula.



        There are a couple of alternative approaches that might be interesting, though they don’t lead to simple general formulas, either, and might not be any less work than the above. First notice that you can parameterize your original ellipse as $mathbf c + mathbf ucos t + mathbf vsin t$, where $mathbf c = (h,k)$, $mathbf u = a(costheta,sintheta)$ and $mathbf v=b(-sintheta,costheta)$. Focusing again on the linear part of the transformation, the new ellipse is a translate of $mathbf r(t) = Mmathbf ucos t+Mmathbf vsin t$. The tangent to an ellipse at a vertex is orthogonal to the corresponding principal axis, so a way to find these vertices is to solve $mathbf r(t)cdotmathbf r'(t)=0$ for $t$. Unless you ended up with a circle, there will be two pairs of diametrically opposite solutions. The semiaxis lengths are then just the two lengths $|mathbf r(t)|$ and the rotation angle is also easily computed.



        Another possible approach takes advantage of the fact that the original ellipse (again after translation back to the origin) is itself obtained from the unit circle by scaling and rotation, so that this ellipse when further transformed is obtained from the unit circle via some composite transformation given by the matrix $M'=MRS$, with $$R = begin{bmatrix}costheta&-sintheta\sintheta&costhetaend{bmatrix} text{ and } S = begin{bmatrix}a&0\0&bend{bmatrix}.$$ The SVD of $M'$ refactors it into the product of a rotation, a diagonal matrix (i.e., scaling along orthogonal directions) and another rotation. The half-axis lengths of the ellipse are therefore given by the central diagonal matrix, and, since the first rotation leaves the unit circle unchanged, the ellipse’s principal axis directions are the columns of the left-hand rotation matrix in the SVD. The rotation angle is easily recovered from them.







        share|cite|improve this answer














        share|cite|improve this answer



        share|cite|improve this answer








        edited Jan 22 at 22:28

























        answered Jan 22 at 22:14









        amdamd

        30k21050




        30k21050






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Mathematics Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3076317%2fwhat-is-the-equation-for-an-ellipse-in-standard-form-after-an-arbitrary-matrix-t%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Mario Kart Wii

            Partial Derivative Guidance.

            Understanding the size os this class of aleatory events