from geomdl import BSpline
from geomdl.visualization import VisMPL
# Create a BSpline surface instance (Bezier surface)
surf = BSpline.Surface()
# Set degrees
surf.degree_u = 4
surf.degree_v = 3
# Set control points
control_points = [[0, 0, 0], [0, 4, 0], [0, 8, -3],[1, 12, 5],
[2, 0, 6], [2, 4, 0], [2, 8, 0], [2, 13, 7],
[4, 0, 0], [4, 4, 0], [20, 28, 33], [4, 15,10],
[6, 0, 0], [6, 4, -3], [6, 8, 0],[6, 11, 8],
[8, 0, 0], [8, 5, -3], [8, 8, 0],[8, 12, 9]]
surf.set_ctrlpts(control_points, 5, 4)
# Set knot vectors
surf.knotvector_u = [0, 0, 0, 0, 0.4, 0.6, 1, 1, 1, 1]
surf.knotvector_v = [0, 0, 0, 0, 1, 1, 1, 1]
# Set evaluation delta (control the number of surface points)
surf.delta = 0.01
# Evaluate surface points
surf.evaluate()