Draws a torus.
A torus is a 3D shape with triangular faces that connect to form a ring. Toruses with few faces look flattened. Toruses with many faces have smooth surfaces.
The first parameter, radius
, is optional. If a Number
is passed, as in torus(30)
, it sets the radius of the ring. By default, radius
is 50.
The second parameter, tubeRadius
, is also optional. If a Number
is passed, as in torus(30, 15)
, it sets the radius of the tube. By default, tubeRadius
is 10.
The third parameter, detailX
, is also optional. If a Number
is passed, as in torus(30, 15, 5)
, it sets the number of edges used to draw the hole of the torus. Using more edges makes the hole look more like a circle. By default, detailX
is 24.
The fourth parameter, detailY
, is also optional. If a Number
is passed, as in torus(30, 15, 5, 7)
, it sets the number of triangle subdivisions to use while filling in the torus’ height. By default, detailY
is 16.
Note: torus()
can only be used in WebGL mode.
Examples
Syntax
torus([radius], [tubeRadius], [detailX], [detailY])