Home :: Examples :: Ellipse

Ellipse

Ellipse can be defined as the locus of points, or path traced out, in a plane such that the sum of the distances from the moving point to two fixed points remains constant. The two fixed points are then called foci. When the foci coincide the ellipse becomes a circle and the two distances then coincide as its radius. A variant of this replaces one of the foci with a straight line not passing through the remaining focus, called the directrix; in this case the locus is of a point whose distance from the remaining focus maintains a constant ratio less than one with its distance from the directrix.

Ellipse can be represented by the following parametric equations:

To draw ellipse use the folowing script:

# Example
# 2D. Ellipse

# z must be zero
z = 0

# t-parameter
tmin = 0
tmax = 2*pi
tgrid = 400

# Constants
a = 2
b = -1
n = 8
m = 3

# Calculations
x = a + n * sin(t)
y = b + m * cos(t)