Skip to content

Commit 0fbfb06

Browse files
author
Onur R. Bingol
committed
Update surface examples 2 and 3
1 parent 8d50a5e commit 0fbfb06

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

surface/ex_surface02.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
surf = BSpline.Surface()
2424

2525
# Set evaluation delta
26-
surf.delta = 0.05
26+
surf.delta = 0.025
2727

2828
# Set up surface
2929
surf.read_ctrlpts_from_txt("ex_surface02.cpt")
@@ -37,13 +37,13 @@
3737

3838
# Draw the control point grid and the evaluated surface
3939
if render_surf:
40-
vis_comp = VisMPL.VisTriSurf()
40+
vis_comp = VisMPL.VisSurfScatter()
4141
surf.vis = vis_comp
4242
surf.render()
4343

4444
# Save control points and evaluated curve points
45-
surf.save_surfpts_to_csv("surfpts02_orig.csv")
46-
surf.save_ctrlpts_to_csv("ctrlpts02_orig.csv")
45+
surf.save_surfpts_to_csv("surfpts02_orig.csv", mode='linear')
46+
surf.save_ctrlpts_to_csv("ctrlpts02_orig.csv", mode='wireframe')
4747

4848
# Evaluate 1st order surface derivative at the given u and v
4949
u = 0.2

surface/ex_surface03.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,21 @@
1010
import os
1111
from geomdl import NURBS
1212

13+
# Try to load the visualization module
14+
try:
15+
render_surf = True
16+
from geomdl.visualization import VisMPL
17+
except ImportError:
18+
render_surf = False
19+
1320
# Fix file path
1421
os.chdir(os.path.dirname(os.path.realpath(__file__)))
1522

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

1926
# Set evaluation delta
20-
surf.delta = 0.05
27+
surf.delta = 0.025
2128

2229
# Set up surface
2330
surf.read_ctrlpts_from_txt("ex_surface03.cptw")
@@ -29,6 +36,12 @@
2936
# Evaluate surface
3037
surf.evaluate()
3138

39+
# Draw the control point grid and the evaluated surface
40+
if render_surf:
41+
vis_comp = VisMPL.VisSurfWireframe()
42+
surf.vis = vis_comp
43+
surf.render()
44+
3245
# Save control points and evaluated curve points
3346
surf.save_surfpts_to_csv("surfpts03_orig.csv", mode='wireframe')
3447
surf.save_ctrlpts_to_csv("ctrlpts03_orig.csv")

0 commit comments

Comments
 (0)