Lesson 5.3Lesson 5.3 · Geometry & Math for Design
Curves, Surfaces and Meshes
How a model is really stored: polylines and NURBS curves, surfaces, and meshes of vertices and faces
A rendered model looks solid and smooth, but inside the file it is nothing but lists of numbers: points, the lines between them, and the faces that fill them in.
So far a shape has been a handful of points you move around. Real models are richer - curved handrails, freeform façades, terrain, furniture - and to script them you need to know how those are actually stored. The reassuring news is that it is turtles all the way down: every curve, surface and solid in a model is, underneath, just organised lists of coordinates.
This lesson opens the model file and looks inside. We climb a short ladder - points, polylines, smooth NURBS curves, surfaces, and finally meshes of vertices and faces - and see the plain data structure behind each. You will not build a NURBS solver; you will gain the mental model that makes Rhino, Grasshopper and mesh tools stop being black boxes.
Polyline = points in a line. NURBS = control points + rules. Mesh = vertices + faces.
From points to polylines
Start with the simplest step up from a single point: connect several in order and you have a polyline - a chain of straight segments. It is nothing more than a list of points understood as go from this one to the next, in sequence. A room outline, a setting-out path, a section profile - all are polylines, and because a polyline is just a list, everything you learned about lists applies directly.
import math
def polyline_length(pts):
total = 0.0
for a, b in zip(pts, pts[1:]):
total += math.hypot(b[0] - a[0], b[1] - a[1])
return total
path = [(0, 0), (3, 0), (3, 4)]
print(polyline_length(path)) # 7.0The zip(pts, pts[1:]) trick pairs each point with the next one - a clean way to walk the segments of a polyline rather than its points. To close the polyline into a polygon (a room, a plot boundary) you simply treat the last point as joined back to the first, which the geometry algorithms in the next lesson do with pts[(i + 1) % n].
A polyline is exact and lightweight, which is why it is the natural representation for plans, boundaries and anything made of straight runs. Its limitation is right there in the name: it can only be straight between points. Approximate a curve with a polyline and you get a faceted, many-segment thing - fine for analysis, wrong for a smooth handrail. For genuine curves, we need something cleverer.
Polyline = list of points, joined in order. Close it (last -> first) to get a polygon.
NURBS — the smooth curves CAD really uses
The curves in Rhino, Illustrator and most CAD are not polylines but NURBS - Non-Uniform Rational B-Splines. The name is a mouthful; the idea is graspable. A NURBS curve is defined not by points it passes through but by a handful of control points that pull the curve toward them, like magnets shaping a smooth wire. Move a control point and the curve flexes smoothly - which is exactly the responsive, editable behaviour a designer wants.
You almost never build a NURBS curve from raw numbers by hand; instead the tool or library does the maths and you supply the control points and a couple of settings (the degree, which controls smoothness, and a knot vector, which you can usually ignore at first). Conceptually, then, even a freeform curve reduces to a list of control points plus some rules for interpolating between them - data again, just richer data.
# A NURBS curve, conceptually: control points plus a degree.
control_points = [(0, 0), (2, 5), (6, 5), (8, 0)]
degree = 3 # cubic: smooth, the common default
# In rhino3dm or Grasshopper you would pass exactly these to a
# NurbsCurve constructor; the library computes the smooth path.The practical takeaways are two. First, a NURBS curve is resolution-independent - it is a true smooth mathematical curve, not an approximation, so it stays crisp at any zoom. Second, when you script curves in Module 6 you will mostly be assembling control points (which are just points, from Lesson 5.1) and handing them to a library. The scary acronym hides a familiar core.
One distinction worth carrying: control points usually pull the curve toward them without the curve passing through each one - only the endpoints are touched. If you instead have points the curve must pass through (a survey of a road centreline, say), you want an interpolated curve, and libraries offer a separate call for that (often named something like CreateInterpolatedCurve). Knowing which behaviour you need - shaped-by versus passing-through - is the practical decision; the library handles the mathematics either way.
Surfaces — a curve swept into a sheet
Push the idea one dimension further and a curve becomes a surface. Where a NURBS curve is shaped by a row of control points, a NURBS surface is shaped by a whole grid of them - imagine a rubber sheet with a mesh of handles you can pull in and out to sculpt hills and valleys. A flat wall, a curved façade, a doubly-curved roof: all are surfaces defined by a grid of control points and the same smooth-interpolation rules as curves, now running in two directions (often called u and v).
Most surface creation in practice is not done control-point by control-point but by operations: extrude a profile curve, loft between several curves, sweep a section along a rail, revolve a profile around an axis. Each takes curves you already have and produces a surface - and in a script each is a single function call. That is worth holding onto: you rarely place surface control points by hand; you describe a surface as an operation on curves. This is why the curve work matters so much: get your profile and rail curves right, and the surface follows almost for free. A great deal of parametric modelling is really curve wrangling - building and adjusting the curves - with a surface operation on the end.
The data view still holds. A surface stores its grid of control points, its degrees in each direction, and its knot data, plus a domain (the range of u and v). When you evaluate a surface at some (u, v) you get back a point in space - which is how tools drape panels, place components, or sample a façade. You do not need that machinery yet; you need the picture: a surface is a curve idea stretched into a sheet, still built from points and rules.
Curve = row of control points. Surface = grid of control points (u and v). Both smooth.
Meshes — vertices and faces
NURBS are exact and smooth, but for rendering, 3D printing, game engines, analysis and file interchange the world mostly uses meshes. A mesh approximates any shape with lots of flat facets - usually triangles or quadrilaterals - and its data structure is beautifully simple and the most important one to know in this lesson: a list of vertices and a list of faces.
The vertices are just points - (x, y, z) tuples - stored in a list, so each has an index (0, 1, 2, ...). The faces do not repeat coordinates; instead each face is a small tuple of vertex indices saying which corners to connect. This indirection is the whole trick: shared corners are stored once and referred to by number.
vertices = [
(0, 0, 0), # index 0
(4, 0, 0), # index 1
(4, 4, 0), # index 2
(0, 4, 0), # index 3
]
faces = [
(0, 1, 2), # a triangle using corners 0, 1, 2
(0, 2, 3), # a triangle using corners 0, 2, 3
]
print(len(vertices), "vertices,", len(faces), "faces") # 4 vertices, 2 facesThose two lists are the flat square, split into two triangles. Every OBJ, STL and glTF file, every Rhino or Blender mesh, is this pattern at heart - often with millions of entries, but the same two lists. Because faces reference shared vertices by index, moving one vertex updates every face that uses it, and the file stays compact. Once you can read a mesh as vertices plus faces, model files stop being opaque and become data you can generate, inspect and edit.
Choosing a representation
So which do you use? The choice is not about taste; each representation is good at different things, and picking wrongly makes scripts harder than they need to be. A quick guide:
Polylines and polygons for exact, straight-edged 2D: plans, boundaries, setting-out, anything you will measure areas from (Lesson 5.4). Lightweight and precise. NURBS curves and surfaces for smooth, editable, resolution-independent design geometry - the freeform façade, the curved stair, anything that must stay crisp and be reshaped by moving control points. Meshes for display, fabrication, analysis and interchange - when you need to render, 3D-print, run a simulation, or hand geometry to another program.
Real workflows convert between them constantly: you design with NURBS, then mesh it to render or print; you analyse a site as a mesh but set out with polylines. Knowing that a mesh is denser but approximate, and a NURBS surface is exact but heavier to work with, tells you which way to convert and what you lose each time (meshing a curved surface throws away smoothness; you cannot get it back by un-meshing).
For scripting, the headline is liberating: whichever you pick, it bottoms out in the points and lists you already handle. A polyline is a list of points; a NURBS curve is control points plus rules; a mesh is vertices plus faces. The intimidating variety of 3D geometry is a small number of data structures wearing different clothes - and Module 6 puts real Rhino and Grasshopper tools on top of exactly these ideas.
It also helps to know that solids - a wall, a slab, a mullion - are usually one of these representations in disguise: either a closed mesh (a watertight bag of faces) or a set of trimmed NURBS surfaces stitched into a shell, often called a BRep or boundary representation. You will meet that word in Rhino and in BIM tools, and it need not intimidate: it is surfaces bounding a volume, which is surfaces, which is control points, which is points. The whole tower rests on the atom from Lesson 5.1, and that is genuinely all there is underneath even the most elaborate model.
polyline
A list of points joined by straight segments
Exact and lightweight; the natural form for plans, boundaries and profiles. Close it (last to first) to make a polygon.
NURBS
Smooth curves and surfaces defined by control points
Resolution-independent design geometry. You supply control points and a degree; the library computes the smooth path.
mesh (vertices + faces)
A shape approximated by flat facets, stored as two lists
Vertices are points; faces are tuples of vertex indices. The format for rendering, 3D printing, analysis and interchange.
rhino3dm
A Python library for reading and writing Rhino geometry
Gives real NurbsCurve, Surface and Mesh classes built on exactly these ideas. Explored properly in Module 6.
Workshop — build and measure a little mesh
Represent geometry the way a model file does. You will build a polyline, close it into a polygon, and hand-author a small mesh as vertices and faces - proving to yourself that geometry is just lists.
Python 3 and `math`. Optional: `pip install rhino3dm` to create a real Rhino mesh object; matplotlib to plot the polyline.
Goal: create a polyline and a mesh from plain lists and inspect them Inputs: coordinates you choose Time: ~35 minutes
- 1Write
polyline_length(pts)usingzip(pts, pts[1:])and test it on[(0, 0), (3, 0), (3, 4)]- expect7.0. - 2Define a square as four vertices and two triangular faces, exactly as in the lesson, and print the counts.
- 3Add four more vertices above the first four (same x and y, a
zof 3) and add faces to turn the flat square into the top and bottom of a box - list the side faces as pairs of triangles. - 4Write a loop that prints, for each face, the actual coordinate tuples it connects by looking each index up in the vertex list.
- 5Reflect in a comment: how many numbers does your mesh store, and how many would it store if every face repeated its corner coordinates instead of using indices? Stretch: install
rhino3dmand create arhino3dm.Mesh, adding your vertices and faces to it.
You’ll walk away with
A script that builds a polyline and measures it, hand-authors a small mesh as vertices and faces, and prints each face resolved back into coordinates - demonstrating the vertices-plus-faces data structure.
Three altitudes on the same idea
Read the band that fits you — or all three.
Knowing how geometry is stored is what lets you script it and diagnose it. When a façade panel export explodes into millions of mesh triangles, when a NURBS surface will not offset cleanly, or when an IFC comes in as meshes rather than solids, the fix starts with understanding vertices-and-faces versus control-points. This lesson is the mental model behind Module 6, and behind every conversation with a fabricator about tolerances and file formats.
Even interiors work touches these representations more than you would think. A joinery profile is a polyline; a curved reception desk is a NURBS surface; a model you send for rendering or a 3D print of a bespoke handle is a mesh. Understanding that smooth design geometry is exact while a mesh is a faceted approximation explains why renders sometimes look faceted and why file sizes balloon - and helps you ask suppliers for the right format.
This is the conceptual key to computational modelling. Grasshopper, Blender, and every parametric exercise assume you know the difference between a curve, a surface and a mesh, and that a mesh is vertices plus faces. Grasp it here - as plain lists of numbers - and generating geometry with code in Module 6, and the mesh and NURBS work in the Computational Design and Visualization courses, will build on solid ground rather than hand-waving.
“The smooth curves and surfaces in CAD are stored as thousands of tiny straight segments.”
Do it yourself
Answer from the data structures, not from a CAD screen.
- 1What is the difference between a polyline and a NURBS curve?
- 2What two lists make up a mesh, and what does each store?
- 3Why do mesh faces store vertex indices rather than the coordinates directly?
- 4Name one job where a mesh is the right representation and one where NURBS is.
- 5What do you lose when you convert a NURBS surface to a mesh?
The one line to carry out
Peer-reviewed journals & authoritative standards
- 01Polygon mesh — Wikipedia, 2026.
- 02Non-uniform rational B-spline — Wikipedia, 2026.
- 03Rhino Developer Documentation — Robert McNeel & Associates, 2026.
- 04Rhinoceros 3D — Wikipedia, 2026.
Now that geometry is data you can read, we can compute _with_ it. The final lesson of this module builds the practical toolkit - is a point inside a polygon, what is its area and centroid, which point is nearest - the spatial logic behind real design scripts.
The author
Amogh N P
Architect, interior designer, and creative polymath. Studio Matrx began in his notebooks — his vision of design made honest, useful, and open to everyone. Its Academy is written and taught in his memory, and free, forever.
More about Amogh →