My Octopress Blog

A blogging framework for hackers.

Ray Tracer Feature: Lathes

Up to this point, my ray tracer had been limited to rendering spheres and triangles, and, while there’s a lot you can do with these primitives, it’s often more efficient and effective to use a lathe or surface or rotation. Imagine you’ve got a curve, and you rotate it around some axis, keeping track of the surface it swept out.

Alternatively, imagine a lump of clay on a clay wheel. As the wheel rotates, if you hold some shape against the clay, it will become a solid that’s symmetrical about the vertical axis. Here’s a sine curve rotated about : [caption id=”attachment_489” align=”aligncenter” width=”300” caption=”A sinusoidal lathe and a sphere.”]A sinusoidal lathe and a sphere.[/caption]

[caption id=”attachment_491” align=”aligncenter” width=”300” caption=”A polynomial curve rotated about x=0.”]A polynomial curve rotated about x=0.[/caption]