Parametric Line Generated SurfaceΒΆ
The Hyperboloid of Revolution example surface.
import numpy as np
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
radius, twist = 1, 0.75
top_circle = lambda t: circle(t,radius, 1, 0.0)
btm_circle = lambda t: circle(t,radius,-1.0,twist)
# 2. Setup and map surfaces .........................................
rez=3
line_1 = s3d.ParametricLine(rez,top_circle)
line_2 = s3d.ParametricLine(rez,btm_circle)
surface = line_1.get_surface_to_line(line_2,lrez=6)
s3d.save_surfgeom_to_obj('obj_files/hyperboloid.obj',surface)