Wolfram Research

Function Repository Resource:

Torus

Source Notebook

Graphics3D primitives for a torus

Contributed by: Jon McLoone

ResourceFunction["Torus"][]

represents a unit radius torus centered at {0,0,0} with a primary radius of 1 and secondary radius of 1/4.

ResourceFunction["Torus"][{x,y,z}]

represents a unit radius torus centered at {x,y,z} with a primary radius of 1 and secondary radius of 1/4.

ResourceFunction["Torus"][pos,{r1,r2}]

represents a unit radius torus centered at pos with a primary radius of r1 and secondary radius of r2.

ResourceFunction["Torus"][pos,{r1,r2},{ax,ay,az}]

represents a unit radius torus centered at pos oriented around a center of rotation with direction {ax,ay,az}.

Examples

Basic Examples

A unit torus:

In[1]:=
Graphics3D[ResourceFunction["Torus"][]]
Out[1]=

A torus at {10,20,30} with primary radius of 20 and secondary radius of 1 around an orientation vector of {0,1,0}:

In[2]:=
Graphics3D[
 ResourceFunction["Torus"][{10, 20, 30}, {20, 1}, {0, 1, 0}], Axes -> True]
Out[2]=

Neat Examples

In[3]:=
Manipulate[
 Graphics3D[{ResourceFunction["Torus"][{0, 0, 0}, {1, n}], ResourceFunction["Torus"][{1/2, 0, 0}, {1, 1/2 - n}, {0, 1, 0}]},
  PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}, {-1.5, 1.5}}],
 {{n, 0.2}, 0, 1/2}]
Out[3]=

Resource History

License Information