The Coordinate Patch Mapping of a Torus in Three-Dimensional Space
Formula1
The coordinate chart mapping of a torus with a distance from the center to the tube of $R$ and the diameter of the tube of $r$ is as follows.
$$ \mathbf{x}(u_{1}, u_{2}) = \left( (R + r\cos u_{2})\cos u_{1}, (R + r\cos u_{2})\sin u_{1}, r\sin u_{1} \right) $$
Where $(u_{1}, u_{2}) \in [0, 2\pi) \times [0, 2\pi)$.
Code
The Julia code to draw the above figure is as follows.
using Plots
Plots.plotly()
r₁ = 3
r₂ = 1
N = 100
torus(u) = [(r₁ + r₂*cos(u[1]))cos(u[2]), (r₁ + r₂*cos(u[1]))sin(u[2]), r₂*sin(u[1])]
X = Vector(0:2pi/N:2pi)
Y = Vector(0:2pi/N:2pi)
U = [[X[i], Y[j]] for i∈1:N for j∈1:N]
xyz = zeros(3,N^2)
M = torus.(U)
for i ∈1:N^2
xyz[:,i] = M[i]
end
scatter(xyz[1,:], xyz[2,:], xyz[3,:], label="", markersize=0.6, markeropacity=0.3, markercolor=:Black, camera=(0,16))
savefig("torus.html")
Richard S. Millman and George D. Parker, Elements of Differential Geometry (1977), p86 ↩︎