Every convex quadrilateral can be regarded as the perspective projection of a unit square (Dörrie, 100 Great Problems of Elementary Mathematics, problem 72). A unit circle inscribed in the unit square projects to an ellipse inscribed in the quadrilateral. This ellipse can be drawn, and its parameters calculated, without reference to any particular configuration of the unit circle, the viewpoint, and the plane of projection. The ellipse is completely determined by the coordinates of the vertices of the quadrilateral.
It easy to find by construction the points where the ellipse touches the quadrilateral. The image of the centre of the unit circle is at the intersection of the diagonals. Opposite sides of the quadrilateral meet in two "vanishing points". A line from each vanishing point through the intersection of the diagonals intersects the quadrilateral at the points of tangency.
The centre of the ellipse can be found by another construction. Bisect the four chords joining the points of tangency. The lines through each mid-point and corresponding vertices of the quadrilateral meet at the centre of the ellipse.
The inclination of the major and minor axes has an inscrutable relationship with the the shape of the quadrilateral. In a figure which may be regarded as representing an array of circular discs, subtle changes of inclination occur between neighbouring ellipses, while tangency at the points of contact is maintained.
Such figures are hard to draw accurately by hand. To draw a circle in perspective, draughtsmen are usually advised to draw an ellipse freehand, tangent to the four points of contact. If the centre is constructed as above, the symmetry of the ellipse can be exploited by rotating the quadrilateral through 180° about the centre to give four additional points of contact.
It is possible to derive a matrix which transforms the unit square by a perspective projection to an arbitrary quadrilateral. The transformation of point p to point q is described by
where ρ is a scale factor (Beardsley, equation 19).
ρ [   ] = T [   ] = [ ] [   ] q0 p0 A B C p0 q1 p1 D E F p1 1 1 G H I 1
The unit square with homogeneous coordinates
is transformed to an arbitrary quadrilateral(-1, 1, 1) ( 1, 1, 1) (-1, -1, 1) ( 1, -1, 1)
by a matrix with these coefficients:-(W0, W1, 1) (X0, X1, 1) (Z0, Z1, 1) (Y0, Y1, 1)
A = X0 Y0 Z1 - W0 Y0 Z1 - X0 Y1 Z0 + W0 Y1 Z0 - W0 X1 Z0 + W1 X0 Z0 + W0 X1 Y0 - W1 X0 Y0 B = W0 Y0 Z1 - W0 X0 Z1 - X0 Y1 Z0 + X1 Y0 Z0 - W1 Y0 Z0 + W1 X0 Z0 + W0 X0 Y1 - W0 X1 Y0 C = X0 Y0 Z1 - W0 X0 Z1 - W0 Y1 Z0 - X1 Y0 Z0 + W1 Y0 Z0 + W0 X1 Z0 + W0 X0 Y1 - W1 X0 Y0 D = X1 Y0 Z1 - W1 Y0 Z1 - W0 X1 Z1 + W1 X0 Z1 - X1 Y1 Z0 + W1 Y1 Z0 + W0 X1 Y1 - W1 X0 Y1 E = -X0 Y1 Z1 + W0 Y1 Z1 + X1 Y0 Z1 - W0 X1 Z1 - W1 Y1 Z0 + W1 X1 Z0 + W1 X0 Y1 - W1 X1 Y0 F = X0 Y1 Z1 - W0 Y1 Z1 + W1 Y0 Z1 - W1 X0 Z1 - X1 Y1 Z0 + W1 X1 Z0 + W0 X1 Y1 - W1 X1 Y0 G = X0 Z1 - W0 Z1 - X1 Z0 + W1 Z0 - X0 Y1 + W0 Y1 + X1 Y0 - W1 Y0 H = Y0 Z1 - X0 Z1 - Y1 Z0 + X1 Z0 + W0 Y1 - W1 Y0 - W0 X1 + W1 X0 I = Y0 Z1 - W0 Z1 - Y1 Z0 + W1 Z0 + X0 Y1 - X1 Y0 + W0 X1 - W1 X0
Given the inverse matrix
the coefficients of the ellipse equation ax2 + 2bxy + cy2 + 2dx + 2fy + g = 0 are
T-1 = [ ] J K L M N O P Q R
a = J2 + M2 - P2
b = JK + MN - PQ
c = K2 + N2 - Q2
d = JL + MO - PR
f = KL + NO - QR
g = L2 + O2 - R2
The centre, angle of rotation, and semi-axis lengths of the ellipse can then be obtained from these coefficients (MathWorld ellipse article, equations 19-23).
Although these formulae allow the ellipse and its axes to be calculated and drawn programmatically, they do not illuminate the underlying geometry. The axes can be determined by some classical constructions (Eagles, problem 81), but the steps are complicated and indirect.
Here is a construction using projective geometry. It is based on a message from José H. Nieto posted to the sci.math newsgroup.
M, N, P, and Q are the points where the ellipse is tangent to the yellow quadrilateral (from the construction described above). Draw the circle through P with tangent m to the quadrilateral at M. This circle is homologous to the ellipse, with M as the centre of homology. Project N and Q on to this circle at N´ and Q´, where MN and MQ, respectively, meet the circle. The green line passing through P and the intersection of lines NQ and N´Q´ is the axis of the homology. The inclination of the ellipse axes is determined by the angle between the homology axis and the tangent m. The red line which bisects this angle is parallel to the major or minor axis of the ellipse.
This construction is interactive, thanks to the JavaSketchpad applet. Coding of the construction was facilitated by Hans Klein's JSPgenerator authoring tool. The applet dynamically updates the construction when a vertex (red dot) of the quadrilateral is dragged to a new position. Note that the homology axis passes through the the two points where the circle intersects the ellipse. This cannot be used to determine the axis, however, as the ellipse has not been drawn at this stage.
The 'Show' button shows the full construction for the endpoints of the major axis AB and the minor axis CD, which fully determine the shape and position of the ellipse. Let S´ be the point where N´Q´ intersects a parallel to NQ through M. The limit line parallel to the homology axis intersects the tangent m at X´. With centre X´ and radius X´M draw a circle which intersects the limit line at points Y´ and Z´. Let U´ and V´ be the intersections with this circle of the lines from the centre of the original circle to Y´ and Z´, respectively. Let Y´V´ meet the original circle at points A´ and B´, and let Z´U´ meet it at C´ and D´. The homologous projection of points A´, B´, C´, and D´ gives the vertices of the ellipse: A, B, C, and D.
Here is another construction to obtain the ellipse axes, based on Philippe Chevanne's construction (step 2).
Chords NM and MQ are bisected by blue and green lines from corresponding vertices of the quadrilateral. These lines intersect at the centre O of the inscribed ellipse. Blue and green lines at the centre parallel to the chords establish the directions of two pairs of conjugate diameters. They intersect a circle passing through O at four points on the circumference. The blue and green lines joining corresponding points intersect at W. The red line passing through W and the centre of the circle intersects the circumference at two points. The red lines through these two points and the centre of the ellipse are the major and minor axes.