Hyperboloid of RevolutionΒΆ

Parametric circular lines are rotated relative to each other, then the surface is created by projecting one circle to the other. The quadrangular faced surface is then triangulated to improve the visualization in the rendering.

```import numpy as np
from matplotlib import pyplot as plt
import s3dlib.surface as s3d

#.. Hyperboloid of Revolution

# 1. Define functions to examine ....................................

def circle(t,r,z,twist) :
theta = (2*t+twist)*np.pi
x = r*np.cos(theta)
y = r*np.sin(theta)
z = z*np.ones(len(t))
return x,y,z

# 2. Setup and map surfaces .........................................
rez=3

line_1 = s3d.ParametricLine(rez,top_circle,color='firebrick')
line_2 = s3d.ParametricLine(rez,btm_circle,color='teal')
lines = line_1 + line_2
lines.set_linewidth(4)

edges = line_1.get_surface_to_line(line_2).edges # create temp surface for 'simple' edges.
edges.set_color('k')

surface = line_1.get_surface_to_line(line_2,lrez=6) # surface takes line_1 color.
surface.triangulate()

# 3. Construct figure, add surfaces, and plot ......................

minmax,ticks=(-1,1), [-1,0,1]
fig = plt.figure(figsize=(8,4))
label = [ str(line_1) +'\n' + str(line_2) +'\n' + str(edges) , str(surface) ]

for i in range(2):
fig.text(0.5*i+0.475,0.975,label[i], ha='right', va='top', fontsize='smaller', multialignment='right')