-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Onur Rauf Bingol
committed
Sep 1, 2018
1 parent
c53d16f
commit a86bcf9
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-125.0,0.0,0.0,1.0;-125.0,0.0,125.0,1.0;0.0,0.0,125.0,1.0;125.0,0.0,125.0,1.0;125.0,0.0,0.0,1.0;125.0,0.0,-125.0,1.0;0.0,0.0,-125.0,1.0;-125.0,0.0,-125.0,1.0;-125.0,0.0,0.0,1.0 | ||
-88.375,70.7,0.0,0.707;-88.375,70.7,88.375,0.707;0.0,70.7,88.375,0.707;88.375,70.7,88.375,0.707;88.375,70.7,0.0,0.707;88.375,70.7,-88.375,0.707;0.0,70.7,-88.375,0.707;-88.375,70.7,-88.375,0.707;-88.375,70.7,0.0,0.707 | ||
-225.0,100.0,0.0,1.0;-225.0,100.0,225.0,1.0;0.0,100.0,225.0,1.0;225.0,100.0,225.0,1.0;225.0,100.0,0.0,1.0;225.0,100.0,-225.0,1.0;0.0,100.0,-225.0,1.0;-225.0,100.0,-225.0,1.0;-225.0,100.0,0.0,1.0 | ||
-229.775,70.7,0.0,0.707;-229.775,70.7,229.775,0.707;0.0,70.7,229.775,0.707;229.775,70.7,229.775,0.707;229.775,70.7,0.0,0.707;229.775,70.7,-229.775,0.707;0.0,70.7,-229.775,0.707;-229.775,70.7,-229.775,0.707;-229.775,70.7,0.0,0.707 | ||
-325.0,0.0,0.0,1.0;-325.0,0.0,325.0,1.0;0.0,0.0,325.0,1.0;325.0,0.0,325.0,1.0;325.0,0.0,0.0,1.0;325.0,0.0,-325.0,1.0;0.0,0.0,-325.0,1.0;-325.0,0.0,-325.0,1.0;-325.0,0.0,0.0,1.0 | ||
-229.775,-70.7,0.0,0.707;-229.775,-70.7,229.775,0.707;0.0,-70.7,229.775,0.707;229.775,-70.7,229.775,0.707;229.775,-70.7,0.0,0.707;229.775,-70.7,-229.775,0.707;0.0,-70.7,-229.775,0.707;-229.775,-70.7,-229.775,0.707;-229.775,-70.7,0.0,0.707 | ||
-225.0,-100.0,0.0,1.0;-225.0,-100.0,225.0,1.0;0.0,-100.0,225.0,1.0;225.0,-100.0,225.0,1.0;225.0,-100.0,0.0,1.0;225.0,-100.0,-225.0,1.0;0.0,-100.0,-225.0,1.0;-225.0,-100.0,-225.0,1.0;-225.0,-100.0,0.0,1.0 | ||
-88.375,-70.7,0.0,0.707;-88.375,-70.7,88.375,0.707;0.0,-70.7,88.375,0.707;88.375,-70.7,88.375,0.707;88.375,-70.7,0.0,0.707;88.375,-70.7,-88.375,0.707;0.0,-70.7,-88.375,0.707;-88.375,-70.7,-88.375,0.707;-88.375,-70.7,0.0,0.707 | ||
-125.0,0.0,0.0,1.0;-125.0,0.0,125.0,1.0;0.0,0.0,125.0,1.0;125.0,0.0,125.0,1.0;125.0,0.0,0.0,1.0;125.0,0.0,-125.0,1.0;0.0,0.0,-125.0,1.0;-125.0,0.0,-125.0,1.0;-125.0,0.0,0.0,1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
Examples for the NURBS-Python Package | ||
Released under MIT License | ||
Developed by Onur Rauf Bingol (c) 2018 | ||
Toroidal surface is contributed by Harshil Shah (@harshilsofeshah) | ||
""" | ||
|
||
import os | ||
from geomdl import NURBS | ||
from geomdl import exchange | ||
from geomdl.visualization import VisMPL | ||
|
||
|
||
# Fix file path | ||
os.chdir(os.path.dirname(os.path.realpath(__file__))) | ||
|
||
# Create a NURBS surface instance | ||
surf = NURBS.Surface() | ||
|
||
# Set degress | ||
surf.degree_u = 2 | ||
surf.degree_v = 2 | ||
|
||
# Set control points | ||
surf.set_ctrlpts(*exchange.import_txt("ex_torus.cptw", two_dimensional=True)) | ||
|
||
# Set knot vectors | ||
surf.knotvector_u = [0, 0, 0, 0.25, 0.25, 0.5, 0.5, 0.75, 0.75, 1, 1, 1] | ||
surf.knotvector_v = [0, 0, 0, 0.25, 0.25, 0.5, 0.5, 0.75, 0.75, 1, 1, 1] | ||
|
||
# Set sample size and evaluate surface | ||
surf.sample_size = 25 | ||
surf.evaluate() | ||
|
||
# Import colormaps | ||
from matplotlib import cm | ||
|
||
# Plot the surface | ||
vis_config = VisMPL.VisConfig(ctrlpts=True, axes=True, legend=False) | ||
vis_comp = VisMPL.VisSurfTriangle(vis_config) | ||
surf.vis = vis_comp | ||
surf.render(colormap=cm.coolwarm) | ||
|
||
# Good to have something here to put a breakpoint | ||
pass |