You can draw an ellipse by drawing a circle tilted towards or away from the viewer.

Project #1

Draw an ellipse in the x,y plane (z = 0).

circle radius = 200

tilt angle = ^{°}30.0, ^{°}60.0, ^{°}90.0

x = [0,25,50,75,100,125,150,175,190,200]
Why 190? It doesn't fit the pattern.

Project #2

Create and interactive program to draw an ellipse in the x,y plane (z = 0).
Ask the user to input:

circle radius

x coordinate draw interval (x = 0 to radius)
(distance between x coordinates to draw. e.g. 0,5,10,15,10...)

tilt angle

Design Notes, etc.

1. Because we are drawing individual pixels, round x,y coordinates to integer values.

2. You only need to calculate 1/4 if the points on the surface of the ellipse.
The ellipse is symmetrical around the x and y axes when drawn in the xy plane (z = 0).

Note: This code tilts the circle around the X axis.

win = create_a_drawing_window()
for x in [0,1,2,3,4, ..., r]:
y = calculate_ellipse_y_coord(x,r,θ)
draw_a_point(win,x,y)
draw_a_point(win,x,-y)
draw_a_point(win,-x,y)
draw_a_point(win,-x,-y)

4. The X coordinate should never be larger that R.

Graphics Library

Use graphics.py to draw the ellipse.
Click HERE
for more information.
(download, install, documentation, ...)

Circle Equation with Radius R

x^{2} + y^{2} = r^{2}

Ellipse Equation with Radius R and Tilt Angle θ

x^{2}/r^{2} + y^{2}/(r^{2}cos^{2}(θ)) = 1 or x^{2} + y^{2}/cos^{2}(θ) = r^{2} or y^{2} = cos^{2}(θ) * (r^{2} - x^{2})