1. Practicing with cameras
1.1. Cow turntable
1.2. Dolly zoom
y′i = yi / [(zi + d) tan(fov / 2)]
max(y′) − min(y′) = constant
For each field of view, binary search finds the camera distance that keeps the cow's projected height at 112.86 pixels, matching the 60° view. This accounts for the different depths of its vertices. The height varies by less than 0.001 pixels across the camera sweep; the cow and ground still change perspective.
2. Practicing with meshes
Both meshes use manually listed vertices and faces, with triangle vertices ordered so the normals point outward.
3. Re-texturing a mesh
color1 = (0.1, 0.3, 0.9) and color2 = (1.0, 0.45, 0.1).
α = (z − zmin) / (zmax − zmin)
color = (1 − α) color1 + α color2
Vertex colors depend on z; the renderer interpolates them across each triangle.
4. Camera transformations
The base camera has R0 = I and T0 = (0, 0, 3). The transformed camera uses R = Rrelative R0 and T = Rrelative T0 + Trelative.
Rotate

R_relative = [[ 0, 1, 0],
[-1, 0, 0],
[ 0, 0, 1]]
T_relative = [0, 0, 0]
This rolls the view so the cow appears rotated 90° clockwise. Its head and the green y-axis point right.
Zoom out

R_relative = I T_relative = [0, 0, 2]
The translation becomes (0, 0, 5). Increasing the distance makes the cow smaller without changing the field of view.
Shift

R_relative = I T_relative = [0.5, -0.5, 0]
Positive view-space x points left in PyTorch3D, and negative y points down. The cow moves left and down.
Side view

R_relative = [[ 0, 0, 1],
[ 0, 1, 0],
[-1, 0, 0]]
T_relative = [-3, 0, 3]
The rotation turns the view by 90° around y. RrelativeT0 is (3, 0, 0), so the added translation restores T = (0, 0, 3) and keeps the cow centered.
5. Rendering generic 3D representations
5.1. Point clouds from RGB-D images
Unprojecting each masked depth image with its supplied camera gives 125,035 and 123,749 points. These CPU renders use every eighth point: 15,630 and 15,469 points, with 31,099 in the union. Use --point_stride 1 to render all points.
All three clouds use the same camera orbit, with −y pointing up to keep the plant upright. The union fills in parts of the leaves missing from either view alone. Gaps around the leaves and pot, along with stray points outside the plant, remain from imperfect depth estimates and masks.
Individual GIFs: view 1, view 2, union.
5.2. Parametric functions
Torus: (x, y, z) = ((1 + 0.35 cos v) cos u, 0.35 sin v, (1 + 0.35 cos v) sin u)
Ellipsoid: (x, y, z) = (0.8 sin v cos u, 1.2 cos v, 0.65 sin v sin u)
Both surfaces use 100 × 100 parameter samples, colored by normalized xyz coordinates. For the torus, both angles cover a full turn. For the ellipsoid, u covers a full turn and v runs from 0 to π. The torus's points form visible rows, with wider gaps around the outside of the ring. Uniform parameter spacing does not give uniform surface-area density.
5.3. Implicit surfaces
Torus: F(x, y, z) = (√(x² + z²) − 1)² + y² − 0.35²
Ellipsoid: F(x, y, z) = (x / 0.8)² + (y / 1.2)² + (z / 0.65)² − 1
Marching cubes extracts F = 0 from a 48³ grid over [−1.6, 1.6]³. The returned voxel indices are converted to world coordinates using the grid spacing, 3.2 / 47.
Mesh versus point cloud
The torus mesh has a continuous, shaded surface. In the point cloud, gaps between rows depend on the point spacing and radius. Point clouds are easy to build from depth images because no faces need to be connected. Meshes need triangle indices and, for an implicit surface, an extraction step.
Point clouds store positions and colors. Meshes also store triangle indices, and marching cubes temporarily needs the voxel grid. Total memory depends on the number of points, vertices, faces, and voxels; neither representation is always smaller.
| Object | Point cloud | Mesh |
|---|---|---|
| Torus | 44.7 s | 29.8 s |
| Ellipsoid | 44.4 s | 21.4 s |
Point counts and mesh resolutions differ, so these timings apply to the examples shown. Exact counts and times are in timings.json.
6. Do something fun — snowman
I made this by using three scaled spheres for the body. Smaller spheres make the eyes and buttons, two cylinders make the hat, and a cone makes the nose. The parts have separate vertex colors and are joined into one mesh for rendering.
7. Sampling points on meshes
Triangles are chosen with probability proportional to their area. Given independent u, v drawn uniformly from [0, 1), the barycentric weights are:
(w₀, w₁, w₂) = (1 − √u, √u (1 − v), √u v)
p = w₀ a + w₁ b + w₂ c
The square root avoids concentrating samples near one vertex. Vertex colors are interpolated with the same weights. Ten points barely suggest the shape. At 1,000 points, the cow's outline is recognizable; at 10,000, most of the visible surface is filled in.
Reproduce the results
python -m starter.assignment --section all python test_geometry.py
All renders use PyTorch3D on the CPU, with four PyTorch threads and gradient tracking disabled. Animations contain 60 frames and loop at an average of 15 fps. The sampling seed is 7.