From Random 3D Polygon to Ellipse
This code shows in a html5 canvas a random 3D polygon with random edges. With each iteration, a new polycon of 100 new points and edges is defined using the midpoints of each edge. Do this repeatedly and an ellipse will eventually form!
It uses Phoria to render (see http://www.kevs3d.co.uk/dev/phoria/) and is based on the 2D example on http://www.jasondavies.com/random-polygon-ellipse/