3D Toron
Verfasst: Montag 25. August 2025, 12:53
Ich würde gerne einen Toron (phys. topologisches Objekt) 3D visualisieren.
die Grafik bis jetzt ist auch ok, aber diese sich windenden Bänder sollten Bänder sein, also nicht durchgehen bis zur Achse (hier ein Bild wie es aussehen sollte: https://www.scinexx.de/news/physik/phys ... aus-licht/). Ich komme absolut nicht weiter leider
Code: Alles auswählen
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import hsv_to_rgb
plt.style.use('dark_background')
# Parameter
l = 8 # Arme
k = 3.0 # Torsion
r0 = 3.0 # Grundradius
a = 0.7 # Arm-Modulation
wz = 3.0 # Gauß-Hüllkurve entlang z
zmax = 15.0 # Länge
Nu, Nv = 100, 100 # Auflösung
# Parameterflächen
u = np.linspace(0, 2*np.pi, Nu)
v = np.linspace(-zmax, zmax, Nv)
U, V = np.meshgrid(u, v)
phase = l * U + k * V
R = r0 * (10.0 + a * np.cos(phase)) * np.exp(-(V / wz)**2)
X = R * np.cos(U)
Y = R * np.sin(U)
Z = V
# Farben (HSV → RGB)
hue = (np.mod(phase, 2*np.pi)) / (2*np.pi)
sat = np.ones_like(hue)
val = np.exp(-(V / wz)**2) * (0.5*(1 + np.cos(phase)))**0.8
rgb = hsv_to_rgb(np.dstack([hue, sat, val]))
# Plot
fig = plt.figure(figsize=(8, 8))
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(X, Y, Z, facecolors=rgb, rstride=1, cstride=1, antialiased=False)
ax.set_axis_off()
# >>> Sicht von oben (Blick entlang der z-Achse) <<<
ax.view_init(elev=45, azim=20)
plt.show()