Shapes that are built when you ask for them, with a texture coordinate for every corner of every face. Pick a shape below, change its sliders, and put a picture on it. Drag to turn it, scroll or pinch to zoom, and right-drag to move it.

 

Loading three.js. If this note stays, the browser could not load or start it (WebGL may be switched off: Settings > System > "Use graphics acceleration when available").

These are the primitives of my 2003 and 2007 VRML experiments, rebuilt as small functions in geometry/procedural-shapes.js. The cone, the cylinder and the torus were VRML PROTOs with a script that wrote the points, and the sphere folder held several ways of making a sphere. Each shape returns the fields of a VRML IndexedFaceSet: coord, coordIndex, and now also texCoord and texCoordIndex, which the old versions never had. The faces are real polygons: the sides of a cylinder are quads and its caps are one polygon each.

One function behind most of it: sweep

Nearly everything here is made by a single function, PROCEDURAL.sweep(). It takes a section (a closed or open curve in two coordinates) and a path (points in space, each with a frame saying which way is out and which way is up) and carries the section along the path. The texture's u runs along the path and v around the section, so every shape gets texture coordinates for free. A ring that shrinks to nothing, or a section point on the axis, becomes a pole. The options are small:

Paths come from a few builders: circlePath() is a circle round the vertical axis (a surface of revolution, which lathe(profile, ...) wraps up for you), curvePath() follows a closed curve and openPath() an open one, both carrying a frame along it so the tube does not twist. So a new shape is usually a few lines: pick a section, pick a path, say how it grows or turns.

The shapes and what they are controlled by

Primitives
Cylinder / Cone - a straight profile turned round the axis. Top radius, bottom radius, height, segments, and checkboxes for side, top and bottom. Slide the top radius to 0 and the cylinder becomes a cone and its top disappears. Torus - a circle that does not touch the axis. Ring radius, tube radius, and segments around the ring and around the tube.
Spheres
UV - a half circle turned round the axis: segments (longitude) and rings (latitude). Cube, Octahedron, Icosahedron - a solid pushed out onto a sphere, with one slider for how finely it is cut (see below). These three are not sweeps.
Revolved
A profile curve turned round the axis. Vase - height, base radius, belly radius, neck radius and lip flare, with an open lip instead of a top. Lemon - half length, radius and the length of the point at each end. Both take segments round and rings along the profile.
Knots
A circle carried along a closed knot: the trefoil, the figure-eight, the (2,5), (3,4) and (3,5) torus knots and a Lissajous knot. Tube thickness (as thick as the knot's nearest strands allow at 1), segments along the knot and segments around the tube. The first three are also the targets of the torus on the Blue Marble and Shape Morphing pages.
Swept
Shapes that use the scale or twist of a sweep, or an open path. Moebius - a short line carried round a ring and turned: half turns (odd is one-sided, even an ordinary twisted band), ring radius, half width, segments and points across the strip. Shell - a circle along a spiral that widens: turns, growth per turn, how far it sinks, tube size and segments. Spring - a circle along a helix with a flat end on each side: turns, coil radius, wire radius, height and segments. Tentacle - a circle along a winding path, flat at the root and thinning to a point: length, root radius, taper, windings, sway and segments. Column - a star turned as it is carried up a line, with a flat top and bottom: star points, inner radius, turns (negative turns it the other way), radius, height and segments.

The UV sphere is the one everybody knows, rings of latitude and segments of longitude with a point at each pole. The other spheres start from a solid and push it out onto a sphere: the cube sphere splits each face of a cube into squares, and the octahedron and icosahedron spheres split every triangle into four again and again, which is what the subdivision slider does (the octahedron one is the old Sphere.wrl and BetterSphere, and each step is a level of detail of LODSphere). The icosahedron one is the geodesic sphere, whose triangles are the most alike.

The spheres wear the picture the way a world map does: u runs east and v up, so the Earth picture lands in the right place. The hard part is the seam, where the picture ends and starts again: a face that crosses it gets texture coordinates that run on past 1 instead of racing back across the whole picture, and a corner at a pole takes the middle of its neighbors' u. The cube sphere shows the whole picture on each of its six sides, since a face with a pole inside cannot wear a world map.

This page was created with Claude Code.