Skip to content

Commit

Permalink
Update surface examples 2 and 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Onur R. Bingol committed Jan 21, 2018
1 parent 8d50a5e commit 0fbfb06
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
8 changes: 4 additions & 4 deletions surface/ex_surface02.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
surf = BSpline.Surface()

# Set evaluation delta
surf.delta = 0.05
surf.delta = 0.025

# Set up surface
surf.read_ctrlpts_from_txt("ex_surface02.cpt")
Expand All @@ -37,13 +37,13 @@

# Draw the control point grid and the evaluated surface
if render_surf:
vis_comp = VisMPL.VisTriSurf()
vis_comp = VisMPL.VisSurfScatter()
surf.vis = vis_comp
surf.render()

# Save control points and evaluated curve points
surf.save_surfpts_to_csv("surfpts02_orig.csv")
surf.save_ctrlpts_to_csv("ctrlpts02_orig.csv")
surf.save_surfpts_to_csv("surfpts02_orig.csv", mode='linear')
surf.save_ctrlpts_to_csv("ctrlpts02_orig.csv", mode='wireframe')

# Evaluate 1st order surface derivative at the given u and v
u = 0.2
Expand Down
15 changes: 14 additions & 1 deletion surface/ex_surface03.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,21 @@
import os
from geomdl import NURBS

# Try to load the visualization module
try:
render_surf = True
from geomdl.visualization import VisMPL
except ImportError:
render_surf = False

# Fix file path
os.chdir(os.path.dirname(os.path.realpath(__file__)))

# Create a NURBS surface instance
surf = NURBS.Surface()

# Set evaluation delta
surf.delta = 0.05
surf.delta = 0.025

# Set up surface
surf.read_ctrlpts_from_txt("ex_surface03.cptw")
Expand All @@ -29,6 +36,12 @@
# Evaluate surface
surf.evaluate()

# Draw the control point grid and the evaluated surface
if render_surf:
vis_comp = VisMPL.VisSurfWireframe()
surf.vis = vis_comp
surf.render()

# Save control points and evaluated curve points
surf.save_surfpts_to_csv("surfpts03_orig.csv", mode='wireframe')
surf.save_ctrlpts_to_csv("ctrlpts03_orig.csv")
Expand Down

0 comments on commit 0fbfb06

Please sign in to comment.