-
Notifications
You must be signed in to change notification settings - Fork 268
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
Showing
34 changed files
with
2,142 additions
and
169 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
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,16 @@ | ||
2019/11/19 | ||
- added PDV paraview file reading. | ||
- PDB protein data bank file reader | ||
- added error bars in plotxy() | ||
- fast fitting of 2d circles with utils.fitCircle2D() | ||
- added flag-style pop-up labels for meshes and volumes | ||
- added settings for resolving polygonal clashes with mesh edges | ||
- built in set of parametric surfaces in shapes.py module | ||
- improved plotting2d with error bars | ||
- added warpMeshToPoint() method | ||
- improved texture control, can pass texture coords explicitly | ||
- fix trimesh problem with coloring vertices | ||
- can use "panel" backend in notebooks | ||
|
||
|
||
|
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
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
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
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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
""" | ||
Mirror a mesh along one of the Cartesian axes. | ||
Hover mouse to see original and mirrored. | ||
""" | ||
from vtkplotter import Plotter, Text, datadir | ||
|
||
vp = Plotter(axes=2) | ||
|
||
myted1 = vp.load(datadir+"teddy.vtk") | ||
myted1 = vp.load(datadir+"teddy.vtk").flag('original') | ||
|
||
myted2 = myted1.clone().mirror("y").pos([0, 3, 0]).color("green") | ||
myted2 = myted1.clone().mirror("y").pos([0, 3, 0]).c("green").flag('mirrored') | ||
|
||
vp.show(myted1, myted2, Text(__doc__), viewup="z") |
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
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,26 @@ | ||
"""Assign texture coordinates to a polygon | ||
""" | ||
from vtkplotter import Actor, Text, datadir, show | ||
|
||
# define a polygon of 4 vertices: | ||
polygon_a = [ | ||
[(82, 92, 47), (87, 88, 47), # x,y,z of vertices | ||
(93, 95, 47), (88, 99, 47)], | ||
[[0, 1, 2, 3]], # vertex connectivity | ||
] | ||
|
||
# texture coordinates, one (u,v) pair for each vertex: | ||
tc = [(0,0), (1,0), (1,1), (0,1)] | ||
#tc = [(0,0), (2,0), (2,2), (0,2)] | ||
|
||
# create the vtkActor | ||
a = Actor(polygon_a) | ||
|
||
a.texture(datadir+"images/dog.jpg", | ||
tcoords=tc, | ||
interpolate=True, | ||
repeat=True, # when tcoords extend beyond [0,1] | ||
edgeClamp=False, # only used when repeat is False | ||
) | ||
|
||
show(a, Text(__doc__), axes=8) |
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,23 @@ | ||
"""Hover mouse onto an object | ||
to pop a flag-style label | ||
""" | ||
from vtkplotter import * | ||
|
||
# Can modify default behaviour through settings: | ||
#settings.flagDelay = 0 # popup delay in milliseconds | ||
#settings.flagFont = "Courier" # font type ("Arial", "Courier", "Times") | ||
#settings.flagFontSize = 18 | ||
#settings.flagJustification = 0 | ||
#settings.flagAngle = 0 | ||
#settings.flagBold = False | ||
#settings.flagItalic = True | ||
#settings.flagShadow = False | ||
#settings.flagColor = 'black' | ||
#settings.flagBackgroundColor = 'white' | ||
|
||
s = load(datadir+'/bunny.obj').flag() # picks filename by default | ||
c = Cube(side=0.2).x(0.3).flag('my cube\nlabel') | ||
|
||
#s.flag(False) #disable | ||
|
||
show(s, c, Text(__doc__)) |
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
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
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
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,8 @@ | ||
from vtkplotter import * | ||
|
||
Earth(r=1).x(3) # set position x=3 | ||
|
||
Sphere(r=.3).x(-3).texture('marble2') | ||
|
||
printc('press keypad 1-9 to change axes style', box='-', invert=1) | ||
show(..., axes=11, bg='db', bg2='k', verbose=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 |
---|---|---|
@@ -1,27 +1,36 @@ | ||
from vtkplotter import plotxy, show | ||
import numpy as np | ||
|
||
x = np.arange(0, 10, 1) | ||
y = np.sin(x) | ||
x = np.arange(0, 10, 1) | ||
y = np.sin(x) | ||
|
||
# assign errors to both x and y | ||
ye = np.random.rand(10)/2 | ||
xe = np.random.rand(10) | ||
|
||
############## | ||
plt1 = plotxy( | ||
[x, y], | ||
yscale=3, # set an optional scaling factor | ||
[x, y], # accepts different formats | ||
yscale=3, # set an optional y-scaling factor | ||
xlimits=(-1, 11), | ||
splined=False, | ||
lc="r", | ||
marker="*", | ||
mc="dr", | ||
lc="r", # line color | ||
marker="*", # marker style | ||
mc="dr", # marker color | ||
) | ||
|
||
############## | ||
plt2 = plotxy( | ||
[x+1, y+0.2], | ||
yscale=3, # choose the same y-scale as above | ||
xerrors=xe, # show error bars | ||
yerrors=ye, | ||
yscale=3, # choose the same y-scale as above! | ||
splined=True, | ||
xtitle="x variable (mm)", | ||
ytitle="y(x)", | ||
lc="b", | ||
marker="D", | ||
marker="s", # o, p, *, h, D, d , v, ^, s, x, a | ||
) | ||
|
||
############## | ||
show(plt1, plt2, bg="w", axes=1) |
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
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
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
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
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
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
Oops, something went wrong.