Figure 1—A Chunky Donut
TorusGeometry(100, 25, 8, 25)
Like the sphere, the donut shape is built from chunks. The chunks can be
made bigger or smaller around the inner tube, which we can set by including
a third number when defining the TorusGeometry. We can also adjust the size
of the chunks around the outside of the donut by including a fourth number.
Try experimenting with numbers like the following and see what happens.
varshape =newTHREE.TorusGeometry(100, 25, 8, 25);
varcover =newTHREE.MeshNormalMaterial();
vardonut =newTHREE.Mesh(shape, cover);
scene.add(donut);
Now that is a good-looking donut:
TorusGeometry(100, 25, 8, 25, 3.14)
We can play one other trick with donuts. Try adding another number, 3.14,
to the TorusGeometry shape:
report erratum • discuss
Making Shapes with JavaScript • 13
Prepared exclusively for Michael Powell