0

what is the function of ellipse perimeter depending on the angle of ellipse rotation in space? Let's start with a very simple one-axis (be it major semiaxis plane) rotation using the approximated perimeter equation:

l ≈ π(3/2 (a+b)-√ab).

My aim is to show how the perimeter value changes for an elliptical defect in heart when seen from different angles.

Please note that I am not a mathematician (I am MD), therefore I would greatly appreciate to keep things as simple as possible.

Thanks for your help, Jan

  • Welcome to MSE. Please use MathJax. – José Carlos Santos Jan 06 '18 at 18:03
  • Would it be possible to work with the apparent area of the ellipse, instead? It would be much, much easier to work with, both mathematically as well as in a computer program. Ellipse perimeter lengths yield elliptical integrals, which are (in my humble opinion) quite horrible to work with, and hard to derive approximations from. – Nominal Animal Jan 06 '18 at 18:18
  • Related: https://math.stackexchange.com/questions/2583133/efficient-approach-for-calculating-perimeter-of-ellipse/2583237#2583237 – Jack D'Aurizio Jan 06 '18 at 18:20
  • @NominalAnimal: I disagree. Elliptic integrals are a beatiful subject, and given the relation between $K$ and the $\text{AGM}$ they can be effectively used for numerical purposes, like the computation of a couple of billions of digits of $\pi$. – Jack D'Aurizio Jan 06 '18 at 18:21
  • Hi, the area analysis may be useful too but the thing is I am investigating the perimeter so area alone will not answer my main question. – Jan Henzel Jan 06 '18 at 18:34
  • @JackD'Aurizio: They are beautiful, and interesting for sure; I only meant that to us non-mathematicians, they are hard to work with. (As to "horrible", it was the closest word I could come up with, as I needed "hard" for later. Me fail English.) The vocabulary is vast, and their complete knowledge is assumed. The learning curve to a non-mathematician is near vertical. For example, in your notes, you use the abbreviation AGM six pages before actually explaining what you mean by it. This is typical in math, and contributes to the learning curve. – Nominal Animal Jan 06 '18 at 19:32
  • @JanHenzel: Are you referring to a planar ellipse (like a lesion on the surface of the heart), or to the observed 2D perimeter of a 3D ellipsoid (like a clump of abnormal cells)? – Nominal Animal Jan 06 '18 at 19:33
  • .. and after reading my comments above, I realized I failed English on two levels at the same time. I should have written that working with elliptical integrals (for example the perimeter of an ellipse), a non-mathematician would get maximum use of the existing knowledge by having a mathematician to collaborate with. If I were to write software to analyze e.g. sonograms or x-rays of such features using the variation in the length of the perimeter as a function of the viewing angle/direction, at some point I personally definitely would. Someone like Jack D'Aurizio would be invaluable for me. – Nominal Animal Jan 06 '18 at 19:41
  • @NominalAnimal I mean a planar ellipse (a hole) - how its visible / apparent perimeter changes when rotating the figure (from the "true" ie en face view perimeter to the 2 x semimajor axis lenghth at 90o). I really hope it is possible to present it in an understandable form... – Jan Henzel Jan 06 '18 at 19:47

1 Answers1

0

The underlying problem is that when the ellipse is projected to a plane, the projected semiaxes are not the semiaxes of the projected ellipse. For example: Projected ellipse and actual and apparent semi-major axes The two ellipses are exactly the same. The blue lines on the left are the axes of the original ellipse. The red lines on the right are the axes of the projected ellipse.

If the projected semiaxes ("half-axes") are $\vec{a}$ and $\vec{b}$, the points $\vec{p}(\varphi)$ on the projected ellipse are $$\vec{p}(\varphi) = \vec{a}\cos\varphi + \vec{b}\sin\varphi$$

If we have a function $L(a, b)$ that yields the (approximate) perimeter of an ellipse with semiaxes $a$ and $b$, we need functions $u(\vec{a}, \vec{b}) \ge 0$ and $v(\vec{a}, \vec{b}) \ge 0$ that yield the actual lengths of the semiaxes of the projected ellipse. Then, the length of the perimeter of the projected ellipse is $L\left(u(\vec{a}, \vec{b}), v(\vec{a}, \vec{b})\right)$.

By finding the extrema of $\vec{p}(\varphi)$, I found the solutions r1 = $u(\vec{a}, \vec{b})$ and r2 = $v(\vec{a}, \vec{b})$, using Sagemath:

r1 = sqrt( ( ax^4*bx^2 + 2*ax^2*ay^2*bx^2 + ay^4*bx^2 + 2*ax^2*bx^4 - 2*ay^2*bx^4 + bx^6 + 8*ax*ay*bx^3*by + ax^4*by^2 + 2*ax^2*ay^2*by^2 + ay^4*by^2 + 3*bx^4*by^2 + 8*ax*ay*bx*by^3 - 2*ax^2*by^4 + 2*ay^2*by^4 + 3*bx^2*by^4 + by^6 + sqrt(ax^4 + 2*ax^2*ay^2 + ay^4 + bx^4 + 8*ax*ay*bx*by + by^4 + 2*(ax^2 - ay^2)*bx^2 - 2*(ax^2 - ay^2 - bx^2)*by^2)*(ax^2*bx^2 - ay^2*bx^2 + bx^4 + 4*ax*ay*bx*by - ax^2*by^2 + ay^2*by^2 + 2*bx^2*by^2 + by^4)
           ) / ( ax^4 + 2*ax^2*ay^2 + ay^4 + 2*ax^2*bx^2 - 2*ay^2*bx^2 + bx^4 + 8*ax*ay*bx*by - 2*ax^2*by^2 + 2*ay^2*by^2 + 2*bx^2*by^2 + by^4 - sqrt(ax^4 + 2*ax^2*ay^2 + ay^4 + bx^4 + 8*ax*ay*bx*by + by^4 + 2*(ax^2 - ay^2)*bx^2 - 2*(ax^2 - ay^2 - bx^2)*by^2)*(ax^2 + ay^2 - bx^2 - by^2)
           ) )
r2 = sqrt( ( ax^4*bx^2 + 2*ax^2*ay^2*bx^2 + ay^4*bx^2 + 2*ax^2*bx^4 - 2*ay^2*bx^4 + bx^6 + 8*ax*ay*bx^3*by + ax^4*by^2 + 2*ax^2*ay^2*by^2 + ay^4*by^2 + 3*bx^4*by^2 + 8*ax*ay*bx*by^3 - 2*ax^2*by^4 + 2*ay^2*by^4 + 3*bx^2*by^4 + by^6 - sqrt(ax^4 + 2*ax^2*ay^2 + ay^4 + bx^4 + 8*ax*ay*bx*by + by^4 + 2*(ax^2 - ay^2)*bx^2 - 2*(ax^2 - ay^2 - bx^2)*by^2)*(ax^2*bx^2 - ay^2*bx^2 + bx^4 + 4*ax*ay*bx*by - ax^2*by^2 + ay^2*by^2 + 2*bx^2*by^2 + by^4)
           ) / ( ax^4 + 2*ax^2*ay^2 + ay^4 + 2*ax^2*bx^2 - 2*ay^2*bx^2 + bx^4 + 8*ax*ay*bx*by - 2*ax^2*by^2 + 2*ay^2*by^2 + 2*bx^2*by^2 + by^4 + sqrt(ax^4 + 2*ax^2*ay^2 + ay^4 + bx^4 + 8*ax*ay*bx*by + by^4 + 2*(ax^2 - ay^2)*bx^2 - 2*(ax^2 - ay^2 - bx^2)*by^2)*(ax^2 + ay^2 - bx^2 - by^2)
           ) )

where $\vec{a} = ( \text{ax} , \text{ay} )$, $\vec{b} = ( \text{bx} , \text{by} )$, and ^ denotes exponentiation. It can be cleaned up some, but that is drudge work I'll leave to whoever wants to use it.

I tested a quick-and-horribly-dirty version of the above in C,

#include <math.h>

void semiaxes(const double ax, const double ay,
              const double bx, const double by,
              double length[2])
{
    const double  ax2 = ax*ax, ay2 = ay*ay, bx2 = bx*bx, by2 = by*by;
    const double  ax4 = ax2*ax2, ay4 = ay2*ay2, bx4 = bx2*bx2, by4 = by2*by2;
    const double  c1 = sqrt(ax4 + 2*ax2*ay2 + ay4 + bx4 + 8*ax*ay*bx*by + by4 + 2*(ax2 - ay2)*bx2 - 2*(ax2 - ay2 - bx2)*by2);
    const double  s1 = ( ax4*bx2 + 2*ax2*ay2*bx2 + ay4*bx2 + 2*ax2*bx4 - 2*ay2*bx4 + bx2*bx4 + 8*ax*ay*bx*bx2*by + ax4*by2 + 2*ax2*ay2*by2 + ay4*by2 + 3*bx4*by2 + 8*ax*ay*bx*by*by2 - 2*ax2*by4 + 2*ay2*by4 + 3*bx2*by4 + by2*by4 + c1*(ax2*bx2 - ay2*bx2 + bx4 + 4*ax*ay*bx*by - ax2*by2 + ay2*by2 + 2*bx2*by2 + by4)
                       ) / ( ax4 + 2*ax2*ay2 + ay4 + 2*ax2*bx2 - 2*ay2*bx2 + bx4 + 8*ax*ay*bx*by - 2*ax2*by2 + 2*ay2*by2 + 2*bx2*by2 + by4 - c1*(ax2 + ay2 - bx2 - by2) );
    const double  s2 = ( ax4*bx2 + 2*ax2*ay2*bx2 + ay4*bx2 + 2*ax2*bx4 - 2*ay2*bx4 + bx2*bx4 + 8*ax*ay*bx*bx2*by + ax4*by2 + 2*ax2*ay2*by2 + ay4*by2 + 3*bx4*by2 + 8*ax*ay*bx*by*by2 - 2*ax2*by4 + 2*ay2*by4 + 3*bx2*by4 + by2*by4 - c1*(ax2*bx2 - ay2*bx2 + bx4 + 4*ax*ay*bx*by - ax2*by2 + ay2*by2 + 2*bx2*by2 + by4)
                       ) / ( ax4 + 2*ax2*ay2 + ay4 + 2*ax2*bx2 - 2*ay2*bx2 + bx4 + 8*ax*ay*bx*by - 2*ax2*by2 + 2*ay2*by2 + 2*bx2*by2 + by4 + c1*(ax2 + ay2 - bx2 - by2) );
    length[0] = sqrt(s1);
    length[1] = sqrt(s2);
}

with a number of random semiaxis vectors. Calculating the perimeter lengths numerically, the results obtained by direct evaluation of the projected ellipse and those by calculating the perimeter of an axis-aligned ellipse where the semiaxis lengths were provided by semiaxes(), were in excellent agreement. In other words, this seems to work.

  • Thank you very much for your help. However, I feel it looks much too complex for most MDs to get any practical conculsion... so I thought maybe we could assume the rotation is along the long axis of the ellipse, and the only thing that defines the change in its visible perimeter is the semi-minor axis length- please let me know if I get it wrong. Do you think it is possible to show this function Perimeter(angle) in a "digestible" form? Thank you in advance. J. – Jan Henzel Jan 07 '18 at 21:33
  • @JanHenzel: This works, if you have a vector that describes the plane of the ellipse, with respect to the viewing direction -- like a stick pointing out from the center of the ellipse. A single angle won't do. I can clean the code up, and write it in e.g. Python, if you want to use it in say a graphical utility application. (I'd guess that adding two boxes to specify the semiaxis lengths, a visual bar to indicate unit length, the true perimeter length, the apparent perimeter length, and a visual image of the projected ellipse (rotatable), would make it actually useful.) – Nominal Animal Jan 08 '18 at 00:18
  • @JanHenzel: You could also consider editing your question, to add the context of exactly how you would like to use the result -- for example, in a visual application or interactive illustration (perhaps as a web page, using Javascript and SVG or Canvas); in teaching materials for doctors to explain the apparent perimeter of the ellipse; in mathematical form for developers; or something else. – Nominal Animal Jan 08 '18 at 00:20
  • It would be really interesting to compare the visible perimeter change compared with the visible semi-minor axis lenghth during the rotation. The plane with a vector in the ellipse center seems OK. Look, the whole thing doesnt have to be quite sophisticated, a regular function curve should be fine, however any extra graphic presentation is always welcome. The only concern is that I think it would be necessary to establish some limit intervals where the change is most or least marked. If you say a single angle doesnt work, what will be the independent variable? – Jan Henzel Jan 08 '18 at 21:44
  • PS. Do you want me to edit the original question or create a new one? – Jan Henzel Jan 08 '18 at 21:45
  • @JanHenzel: The ratio of apparent to actual ellipse perimeter depends on the viewing direction (relative to both the semiaxes), but also on the eccentricity of the ellipse... for better algebraic analysis, you do need a mathematician. I do computational physics, so I'm much more familiar with the numerical stuff. I'll see if I can throw together a simple web-based example page somewhere. As to edit or new question: if the underlying problem stays the same, edits might be the better choice. Or, if you ask about the underlying problem this would solve instead, I'd write a new question. – Nominal Animal Jan 09 '18 at 07:03
  • As far as the eccentricity is concerned, lets say the major to minor semiaxis ratio is 1.4. And the rotation is around the major semiaxis. This kind of animation would be really useful! Anyway I hope you dont mind if I create a new question; maybe it will be easier to make the mathematical comparison easier once I specify the assumptions we managed to work out here right on the start. – Jan Henzel Jan 09 '18 at 16:05
  • @JanHenzel: The interactive example is here. It is self-contained and in public domain, so download it and use however you wish. When editing the numbers at bottom, hit Enter to update the figure. The gray axis (initially invisible, as the ellipse is head on) is the view direction; red and blue are the two other perpendicular axes. I was horribly lazy, and used two angles instead of mouse arcball controls.. sorry! A new question sounds like a good idea. – Nominal Animal Jan 11 '18 at 06:48
  • Amazing job, extremely useful. Thank you so much! – Jan Henzel Jan 11 '18 at 21:33