-
Notifications
You must be signed in to change notification settings - Fork 267
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
74 changed files
with
1,641 additions
and
399 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
include vtkplotter/* | ||
include vtkplotter/textures/* | ||
include vtkplotter/icons/* | ||
include vtkplotter/fonts/* | ||
include vtkplotter/fonts/licenses/* | ||
include vtkplotter/data/* | ||
include vtkplotter/data/images/* | ||
include vtkplotter/data/shapes/* | ||
include vtkplotter/data/timecourse1d/* |
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,12 @@ | ||
from vtkplotter import Cube, Text, show, collection | ||
from vtkplotter.settings import fonts | ||
|
||
Text("List of available fonts:") | ||
|
||
Cube().c('white').rotateX(20).rotateZ(20) | ||
|
||
for i, f in enumerate(fonts): | ||
Text(f+': The quick fox jumps over the lazy dog.', | ||
pos=(5,i*40+20), font=f, c=i%3) | ||
|
||
show(collection(), axes=False) |
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,10 @@ | ||
from vtkplotter import * | ||
|
||
styles = ['default', 'metallic', 'plastic', 'shiny', 'reflective'] | ||
|
||
a = load(datadir+"beethoven.ply").subdivide() | ||
|
||
for i,s in enumerate(styles): | ||
show(a.clone().lighting(s), Text(s), at=i, N=len(styles)) | ||
|
||
interactive() |
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,24 +1,15 @@ | ||
""" | ||
Modify mesh vertex positions. | ||
(vtkActor transformation matrix is reset when mesh is modified) | ||
""" | ||
from vtkplotter import Plotter, Disc, Text | ||
import numpy as np | ||
|
||
|
||
vp = Plotter(axes=4, interactive=0) | ||
|
||
dsc = Disc() | ||
from vtkplotter import * | ||
|
||
dsc = Disc().lineWidth(0.1) | ||
coords = dsc.coordinates() | ||
t = Text(__doc__) | ||
|
||
for i in range(50): | ||
noise = np.random.randn(len(coords), 3) * 0.02 | ||
noise[:, 0] = 0 # only perturb z | ||
noise[:, 1] = 0 | ||
dsc.setPoints(coords + noise) # modify mesh | ||
vp.show(dsc, elevation=-1) | ||
|
||
vp.add(Text(__doc__)) | ||
coords[:,2] = sin(i/10.*coords[:,0])/2 # move vertices in z | ||
dsc.setPoints(coords) # modify mesh | ||
show(dsc, t, axes=8, resetcam=0, interactive=0) | ||
|
||
vp.show(interactive=1) | ||
interactive() |
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,9 +1,9 @@ | ||
"""Make a shadow of 2 meshes on the wall.""" | ||
from vtkplotter import * | ||
|
||
a = load(datadir + "spider.ply").normalize().rotateZ(-90) | ||
s = Sphere(pos=[-0.4, 1.5, 0.3], r=0.3) | ||
a = load(datadir + "spider.ply") | ||
a.normalize().rotateZ(-90).addShadow(x=-4, alpha=0.5) | ||
|
||
shad = Shadow(a, s, direction="x").x(-4) | ||
s = Sphere(pos=[-0.4, 1.4, 0.3], r=0.3).addShadow(x=-4) | ||
|
||
show(a, s, shad, Text(__doc__), axes=1, viewup="z", bg="w") | ||
show(a, s, Text(__doc__), axes=1, viewup="z", bg="w") |
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,37 @@ | ||
""" | ||
Setting illumination properties: | ||
ambient, diffuse | ||
specular, specularPower, specularColor. | ||
""" | ||
#https://lorensen.github.io/VTKExamples/site/Python/Rendering/SpecularSpheres | ||
from vtkplotter import Plotter, Text, Arrow, datadir | ||
|
||
|
||
vp = Plotter(axes=8, bg="w") | ||
|
||
ambient, diffuse, specular = 0.1, 0., 0. | ||
specularPower, specularColor= 20, 'white' | ||
|
||
for i in range(8): | ||
s = vp.load(datadir+'pumpkin.vtk')#.color(i) | ||
s.normalize().pos((i%4)*2.2, int(i<4)*3, 0) | ||
|
||
#s.phong() | ||
#s.gouraud() | ||
s.flat() | ||
|
||
# modify the default with specific values | ||
s.lighting('default', ambient, diffuse, specular, specularPower, specularColor) | ||
#ambient += 0.125 | ||
diffuse += 0.125 | ||
specular += 0.125 | ||
|
||
vp.add(Text(__doc__)) | ||
vp.show() | ||
|
||
print('Adding a light source..') | ||
p = (3, 1.5, 3) | ||
f = (3, 1.5, 0) | ||
vp.addLight(pos=p, focalPoint=f) | ||
vp.add(Arrow(p,f, s=0.01, c='gray', alpha=0.2)) | ||
vp.show() |
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.