Engee documentation
Notebook

Surfaces of rotation, nodes, and spatial curves

Introduction

The study of rotational surfaces and spatial curves is a fundamental branch of differential geometry that relates topological invariants to visual images. In this example, a series of canonical objects is constructed, from minimal surfaces to complex nodal lines and ribbons. Each object has unique geometric characteristics: zero average curvature or non-orientability properties. Computational methods make it possible to visualize the relationship between the formula of an object and its shape in three-dimensional Euclidean space.

In [ ]:
using LinearAlgebra

The Eneper surface

The Eneper surface is a classical minimal surface with zero mean curvature at each point. It is a polynomial parametrization, its shape resembles a saddle symmetrically unfolding in space.

Parametric representation of a surface:

where .

In [ ]:
# The Eneper surface
u = range(-1.5, 1.5, length=50)
v = range(-1.5, 1.5, length=50)

U = repeat(u', length(v), 1)
V = repeat(v, 1, length(u))

X = U .- (U.^3)/3 .+ U .* V.^2
Y = V .- (V.^3)/3 .+ V .* U.^2
Z = U.^2 .- V.^2

surface(X, Y, Z;
    color=Z,
    colormap=:viridis,
    alpha=0.9,
    colorbar=false,
    ratio=:equal,
    title="The Eneper surface"
)
Out[0]:

Coordinate functions are harmonic and satisfy the minimality condition. , where — the Laplace operator. The Eneper surface serves as a reference for studying the global properties of minimal surfaces and their relationship to complex analysis.

The toroid

A torus (toroid) is a surface of rotation obtained by the movement of a circle along another circle. It is a closed orientable surface whose fundamental group is isomorphic to . A torus is a basic object of topology and geometry, as well as a model figure in plasma physics and magnetic confinement.

Parametric equations of a classical torus:

where , — large radius (distance from the center of the torus to the center of the forming tube), — the radius of the section (the radius of the tube).

In [ ]:
# The toroid
R, r = 2.0, 0.7
u = range(0, 2π, length=100)
v = range(0, 2π, length=50)
U = repeat(u', length(v), 1)
V = repeat(v, 1, length(u))
X = (R .+ r .* cos.(V)) .* cos.(U)
Y = (R .+ r .* cos.(V)) .* sin.(U)
Z = r .* sin.(V)
surface(X, Y, Z; c=:jet, colorbar=false, title="The toroid", alpha=1)
Out[0]:

The following parameters are selected in this construction and , which gives a well-defined shape of the figure. Parameter responsible for traversing along the toroid, and — for walking along the transverse circle.

Three-dimensional lemniscate

A lemniscate is a flat figure—of-eight curve, but in this example, its three-dimensional generalization is being constructed. The curve is squeezed into a thin surface by setting an additional linear parameter, creating a "swirling sheet" effect.

Parametric equations of a three-dimensional tape:

where .

In [ ]:
# Three-dimensional lemniscate
u = range(0, 2π, length=300)    
v = range(-0.3, 0.3, length=30)
U, V = [u_i for u_i in u, _ in v], [v_j for _ in u, v_j in v]

x = @. (2 + cos(2U)) * cos(U)
y = @. (2 + cos(2U)) * sin(U)
z = @. sin(2U) + V

surface(x, y, z,
    fill_z = nothing,
    linewidth = 0,              
    linealpha = 0,               
    legend = false,
    aspect_ratio = :equal,
    colorbar = false,
    seriescolor = :thermal,
    alpha = 1.0,
    title = "3D lemniscate",
    camera = (50, 35),
    size = (800, 650)
)
Out[0]:

Expression sets the variable radius in the plane , which forms a characteristic shape with a self-intersection at the origin. Parameter creates a vertical ribbon of constant width, turning a one-dimensional curve into a two-dimensional surface through which the topology of the self-intersection is clearly visible.

Three-dimensional Lissajous figures

Lissajous figures are closed trajectories described by a point making harmonic vibrations in two or three mutually perpendicular directions. In the three-dimensional case, they form complex spatial curves, the shape of which is determined by the ratio of frequencies and the phase difference of vibrations.

Parametric equations:

In this example, the frequencies are selected and the phase shift for the coordinate . The frequency ratios determine the complexity of the pattern: integer ratios give a closed periodic curve, and their simplicity determines symmetry.

In [ ]:
# Three-dimensional Lissajous figures
t = range(0, 2π, length=1000)
x = sin.(3t .+ π/2)
y = sin.(4t)
z = sin.(5t)
plot(x, y, z,
    linewidth = 3,
    legend = false,
    aspect_ratio = :equal,
    title = "3D Lissajous figures",
    xlabel = "X",
    ylabel = "Y",
    zlabel = "Z")
Out[0]:

Three-dimensional Lissajous figures find practical applications in laser animation, multidimensional wave system analysis, and parametric design.

Trefoil Knot

A trefoil is the simplest non—trivial knot that cannot be untied into a circle without cutting the thread. It has three characteristic intersections in the projection and is a classic object of knot theory. In this construction, the node is visualized not just as a line, but as a "tube" — this makes it voluminous and visual.

The central curve is given by the formulas:

where .

In [ ]:
# Trefoil Knot
u = range(0, 2π, length=200)
r_tube = 0.2  
# The main node
x0 = @. sin(u) + 2*sin(2u)
y0 = @. cos(u) - 2*cos(2u)
z0 = @. -sin(3u)
theta = range(0, 2π, length=20)
n_u = length(u)
n_theta = length(theta)
X = zeros(n_u, n_theta)
Y = zeros(n_u, n_theta)
Z = zeros(n_u, n_theta)

for i in 1:n_u
    # Tangent vector
    tx = -cos(u[i]) - 4*cos(2u[i])
    ty = sin(u[i]) - 4*sin(2u[i])
    tz = -3*cos(3u[i])
    T = [tx, ty, tz]
    T = T / norm(T)
    N = nullspace(T') 
    # Creating a tube
    X[i, :] = x0[i] .+ r_tube .* (N[1, 1] .* cos.(theta) .+ N[1, 2] .* sin.(theta))
    Y[i, :] = y0[i] .+ r_tube .* (N[2, 1] .* cos.(theta) .+ N[2, 2] .* sin.(theta))
    Z[i, :] = z0[i] .+ r_tube .* (N[3, 1] .* cos.(theta) .+ N[3, 2] .* sin.(theta))
end

surface(X, Y, Z, 
    fill_z = nothing,
    fillcolor = :cool,
    linewidth = 0,
    legend = false,
    aspect_ratio = :equal,
    colorbar = false)
Out[0]:

To obtain a tube, a small circle of radius r = 0.2 is constructed at each point of the curve, lying in a plane perpendicular to the direction of the curve. To do this, the tangent vector to the curve is calculated, and then two directions perpendicular to it are found. The set of such circles along the entire curve forms a tubular surface, which is represented on the graph.

Conclusion

This computational experiment demonstrates the variety of geometric structures available for modeling using Engee tools. From the polynomial minimal Eneper surface to the tubular neighborhood of the trefoil, each figure illustrates its own class of objects: surfaces of zero curvature, compact surfaces of rotation, spatial curves, and nontrivial nodes.

The constructed models have direct practical significance. Toric knots arise in vortex theory and magnetic hydrodynamics, Lissajous figures describe the trajectories of oscillatory systems in mechanics and electronics, and Eneper surfaces and toroids serve as benchmarks in architectural and industrial design. The technique of constructing tubular neighborhoods of curves, demonstrated by the example of a trefoil knot, is a universal visualization tool for abstract topological objects and can be extended to arbitrary spatial curves.