What algorithm can I use to find this ellipse inscribed in a quadrilateral

geometry

There's a certain drawing exercise designed to improve a drawing student's understanding of perspective and ability to draw shapes freehand. (The actual exercise is described by Irshad Karim on Drawabox.com, on the pages "Ghosted Planes" and "Ellipses in Planes".)

The exercise consists of drawing a convex quadrilateral, then drawing a window-like structure inside the quadrilateral, and finally drawing the ellipse implied by this structure.

Ideally, the result will look similar to this diagram:

A diagram of a drawing exercise

The exact steps of the exercise are:

  1. Draw any convex quadrilateral $ABCD$.
  2. Draw the diagonals of the quadrilateral; call their intersection point $E$.
  3. Draw a line segment passing through $E$, which is concurrent to the edges $AD$ and $BC$. (Line segments are concurrent if they are all parallel, or if, when they are extended to lines, the resulting lines all intersect at a single point.) One endpoint should lie on $AB$, and be labeled $F$; the other endpoint should lie on $CD$, and be labeled $G$.
  4. Likewise, draw a line segment passing through $E$, which is concurrent to the edges $AB$ and $CD$. One endpoint lies on $AD$ and is labeled $H$, the other lies on $BC$ and is labeled $J$.
  5. Finally, draw the unique ellipse which is tangent to $ABCD$ at $F$, $G$, $H$, and $J$.

Given the coordinates of $A$, $B$, $C$ and $D$, what algorithm can be used to find the resulting ellipse?

I'm not 100% sure that there is always a unique ellipse tangent to $ABCD$ at $F$, $G$, $H$ and $J$, but it definitely seems like there is. There's always a unique ellipse which is tangent at $F$ and which passes through $G$, $H$, and $J$; and from experimentation, it looks like this ellipse is always tangent at $G$, $H$ and $J$ as well.

In the case where $ABCD$ is a square, everything is especially simple. The resulting ellipse is the circle inscribed in the square. I suspect that every case is simply the image of this case under some type of perspective transformation which preserves ellipses. But I don't know how to prove this, or how to make use of this fact.

Best Answer

There is a projective transformation that takes the quadrilateral to a square. Draw a circle inscribed in the square, transform back and you get an ellipse inscribed in the quadrilateral.

The answers to this question describe how to find a projective transformation which takes the quadrilateral to a square: Mapping Irregular Quadrilateral to a Rectangle