Parametric Surface Projection¶
By the end of this lab you'll be able to:
- Define a 3D surface with parametric equations
x(u,v),y(u,v),z(u,v) - Project 3D coordinates onto 2D using isometric or perspective projection
- Draw a wireframe mesh by connecting adjacent surface points
A 3D parametric surface — a saddle, torus, or wave — projected onto the 2D canvas using isometric projection. The wireframe mesh shows the surface's shape and curvature without shading.
Welcome to 3D Projection!
3D graphics start here: compute x, y, z for every point on a surface,
then project onto 2D by combining the three coordinates.
This is the foundation of all 3D rendering!
Let's code it together!
How It Works¶
For a saddle surface: x = u, y = v, z = u^2 - v^2. Project to screen: sx = (x - y) * cos30, sy = (x + y) * sin30 + z. Draw grid lines by connecting adjacent points in both the u and v directions.
Sample Code¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
What Do You Think Will Happen?
A saddle surface has the equation z = u² - v² — it curves up in one direction and down in the other.
Will the projection show a clear saddle shape, or will it look flat?
Make your guess — then click Run to find out!
Try It Now¶
A clear 3D saddle shape — the surface curves upward in one diagonal direction and downward in the other. Were you right?
How It Works¶
Isometric projection combines x, y, z into two screen coordinates: sx = (x - y) * cos(30°) and sy = (x + y) * sin(30°) + z. The 30° angles create the "cabinet" isometric view. Drawing grid lines in both u and v directions produces the wireframe mesh.
Explanation Table¶
| Line | What it does |
|---|---|
u = (i - n/2) / (n/4) |
Map grid index to real-valued parameter |
z = (u*u - v*v) * scale / 2 |
Saddle surface equation |
sx = (x - y) * cos30 |
Isometric x projection |
sy = (x + y) * sin30 + z |
Isometric y projection with z height |
Learning Check¶
Your Turn — Change to a Wave Surface
Change z = (u*u - v*v) * scale / 2 to z = scale * math.sin(u) * math.cos(v).
This is a wave surface — predict what it will look like!
A wave surface — undulating peaks and valleys like a frozen ocean wave!
Experiments¶
-
Try a sphere. Use
x = scale*sin(u)*cos(v),y = scale*sin(u)*sin(v),z = scale*cos(u)with u from 0 to π and v from 0 to 2π. You'll know it worked when a sphere wireframe appears. -
Change the projection angle. Replace 30° with 45°. You'll know it worked when the surface looks from a different viewpoint.
-
Increase density. Change
n = 20. You'll know it worked when the wireframe is denser with more grid lines. -
Try a torus.
x = (R + r*cos(v))*cos(u),y = (R + r*cos(v))*sin(u),z = r*sin(v). You'll know it worked when a donut shape appears.
3D from 2D!
You projected a 3D parametric surface onto 2D using isometric math!
This is the foundation of every 3D game engine and CAD software.
Up next: Lindenmayer Snowflake Collection — multiple L-system snowflakes.