Curves Defined by Parametric Equations
A parametric curve gives and as separate functions of a third variable, usually thought of as time. That one change lets you describe loops, self-crossings and motion along a path, none of which a single formula can do. This lesson defines parametric curves carefully, eliminates parameters, derives the cycloid, and shows how games use parametric equations for paths and particle effects.
For a first look, including Bézier curves, see Parametric and Bézier Curves.
Definitions
Let and be functions defined on an interval . The equations
are parametric equations with parameter , and the set of points is a parametric curve. If , the points and are the initial and terminal points, and the curve has an orientation: the direction of increasing .
It is important to separate two things:
- the curve , a set of points, and
- a parametrisation of it, a particular way of tracing it.
The unit circle is traced by for (once, anticlockwise), by for the same (twice, twice as fast) and by (once, clockwise, starting at the top). Same set of points, three different motions. Every graph is a parametric curve, , so parametric curves include everything you had before.
Eliminating the parameter
To find a Cartesian equation, solve one equation for and substitute, or use an identity such as . Keep track of restrictions: the Cartesian equation may describe more points than the parametric curve.
import sympy as sp
t, x, y = sp.symbols("t x y", real=True)
# ellipse: x = 1 + 2cos t, y = -2 + 3 sin t
X, Y = 1 + 2 * sp.cos(t), -2 + 3 * sp.sin(t)
print("ellipse check:", sp.simplify(((X - 1) / 2)**2 + ((Y + 2) / 3)**2))
# x = t², y = t³: resultant eliminates t from x - t², y - t³
print("cusp curve:", sp.resultant(x - t**2, y - t**3, t), "= 0")
# x = cos t, y = cos 2t → y = 2x² − 1, but only for −1 ≤ x ≤ 1
print("y in terms of x:", sp.expand_trig(sp.cos(2 * t)).subs(sp.cos(t), x))ellipse check: 1
cusp curve: x**3 - y**2 = 0
y in terms of x: 2*x**2 - 1
The second curve, , is a semicubical parabola with a cusp at the origin even though and are perfectly smooth: a smooth parametrisation can stop () and turn around. The third traces only an arc of the parabola, back and forth, because never leaves .
The cycloid
A circle of radius rolls along the x-axis without slipping. Follow a point on its rim that starts at the origin. After the circle turns through angle , it has rolled a distance equal to the arc , so its centre is at . Relative to the centre, is at angle clockwise from straight down, i.e. at offset . Adding:
One arch corresponds to . At the velocity is zero, and the curve has cusps. The cycloid answers two famous problems: it is the brachistochrone (curve of fastest frictionless descent between two points) and the tautochrone (a bead released anywhere on an inverted arch reaches the bottom in the same time).
Lissajous curves , close up exactly when is rational; an irrational ratio fills a rectangle densely.
import numpy as np
import matplotlib.pyplot as plt
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9, 3.5))
th = np.linspace(0, 6 * np.pi, 1000)
r = 1.0
ax1.plot(r * (th - np.sin(th)), r * (1 - np.cos(th)))
ax1.set_aspect("equal"); ax1.set_title("cycloid, r = 1, three arches")
t = np.linspace(0, 2 * np.pi, 1000)
ax2.plot(np.sin(3 * t + np.pi / 2), np.sin(2 * t))
ax2.set_aspect("equal"); ax2.set_title("Lissajous a = 3, b = 2, δ = π/2")
plt.tight_layout(); plt.show()
print("arch width 2πr =", round(2 * np.pi * r, 4), ", height 2r =", 2 * r)arch width 2πr = 6.2832 , height 2r = 2.0
In software: paths and particles
Game code is full of parametric curves, because a parametrisation is literally "where is it at time ".
- Paths: enemies following a figure-eight , orbiting pickups , cameras on rails along Bézier or Catmull-Rom splines. A linear segment from to is the parametric curve , the lerp.
- Particle effects: each particle's position is an explicit function of its age, for sparks, plus for swirls. Evaluating a formula per particle (often in a shader) is cheaper and more stable than integrating forces each frame.
- Easing: an easing function reparametrises a path, changing how fast it is traced without changing its shape.
import numpy as np
rng = np.random.default_rng(3)
n = 5
angles = rng.uniform(0, 2 * np.pi, n)
speeds = rng.uniform(4, 8, n)
v0 = np.column_stack([speeds * np.cos(angles), speeds * np.sin(angles)])
g = np.array([0.0, -9.8])
def burst(t): # positions of all sparks at age t
return v0 * t + 0.5 * g * t**2
for t in (0.25, 0.5, 0.75):
pts = burst(t)
print(f"t = {t:.2f}:", [(round(float(px), 2), round(float(py), 2)) for px, py in pts])
def swirl(t, R0=1.0, grow=0.5, w=4.0): # spiral emitter
R = R0 + grow * t
return (R * np.cos(w * t), R * np.sin(w * t))
print("swirl at t = 1:", tuple(round(float(c), 4) for c in swirl(1.0)))t = 0.25: [(1.23, 0.43), (0.12, 1.17), (0.37, -1.41), (-1.51, -1.16), (0.92, 0.31)]
t = 0.50: [(2.46, 0.24), (0.24, 1.72), (0.73, -3.43), (-3.02, -2.94), (1.85, 0.02)]
t = 0.75: [(3.69, -0.55), (0.37, 1.67), (1.1, -6.06), (-4.53, -5.32), (2.77, -0.89)]
swirl at t = 1: (-0.9805, -1.1352)
Exercises
Exercise 1: Eliminate the parameter
Find a Cartesian equation for , , and say which part of that graph is traced.
Answer
for (the right half of the parabola).
Solution
Exercise 2: A segment
Give parametric equations for the segment from to with , and find the point at .
Answer
, ; at the point is .
Solution
Exercise 3: Top of the cycloid
For the cycloid with radius , where is the highest point of the first arch, and what is the speed of there if the circle turns at 1 radian per second?
Answer
, speed (twice the speed of the centre).
Solution
The centre moves at speed ; the top of a rolling wheel moves twice as fast and the contact point is momentarily at rest.
Exercise 4: When does a Lissajous curve close?
The curve , is periodic. Find its smallest period numerically by checking which multiples of bring both coordinates and both velocities back to their starting values, then explain the result.
Answer
Solution
has period and period ; the curve's period is the least common multiple, .
import math
def state(t):
return (math.sin(3*t), math.sin(5*t), 3*math.cos(3*t), 5*math.cos(5*t))
s0 = state(0)
for k in range(1, 17):
T = k * math.pi / 4
if all(abs(a - b) < 1e-9 for a, b in zip(state(T), s0)):
print(f"smallest period found: {k}π/4 = {T:.4f}")
breaksmallest period found: 8π/4 = 6.2832
Test yourself
Which parametrisation traces the unit circle clockwise?
The curve , has a cusp at the origin because…
- is not differentiable
- Its velocity is zero at , so the point can stop and turn
- It is a circle
- It is not a function
In a particle system, why evaluate instead of integrating velocity every frame?
- It is exact and independent of frame rate, and easy to run in a shader
- It uses less memory for textures
- It makes particles collide
- It is required by OpenGL