As of Version 13, Torus is a built-in Graphics3D primitive.

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/2.

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/2.

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 (2) 

A unit torus:

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

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

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

Neat Examples (1) 

Use Manipulate to interactively update torus parameters:

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

Publisher

Jon McLoone

Version History

  • 2.0.0 – 29 January 2021
  • 1.0.0 – 08 July 2019

Author Notes

Inner radius was changed from version one to fix a bug.

License Information