Skip to content
Branch: master
Find file History
Latest commit 8d352cc Jan 21, 2020
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.md 2020.0.2 Jan 20, 2020
a_first_example.py 2020.0.1 Jan 8, 2020
align1.ipynb 2020.0.2 Jan 20, 2020
align1.py 2020.0.2 Jan 20, 2020
align2.ipynb 2020.0.2 Jan 20, 2020
align2.py 2020.0.1 Jan 8, 2020
align3.py 2020.0.1 Jan 8, 2020
bgImage.py 1.0 Dec 19, 2019
boolean.py 2020.0.2 Jan 20, 2020
buildmesh.ipynb 2020.0.2 Jan 20, 2020
buildmesh.py 2020.0.2 Jan 20, 2020
buttons.py 2020.0.2 Jan 20, 2020
cellsWithinBounds.py 1.0 Dec 19, 2019
closewindow.py 1.0 Dec 19, 2019
clustering.ipynb 2020.0.2 Jan 20, 2020
clustering.py 1.0 Dec 19, 2019
colorMeshCells.py 2020.0.1 Jan 8, 2020
colorcubes.py 1.0 Dec 19, 2019
colormaps.py 2020.0.1 Jan 8, 2020
connVtx.ipynb 2020.0.2 Jan 20, 2020
connVtx.py 2020.0.1 Jan 8, 2020
cutter.py 2020.0.2 Jan 20, 2020
delaunay2d.py 2020.0.1 Jan 8, 2020
deleteMeshPoints.py 2020.0.1 Jan 8, 2020
distance2mesh.ipynb 2020.0.2 Jan 20, 2020
distance2mesh.py 2020.0.1 Jan 8, 2020
extrude.py 1.0 Dec 19, 2019
fillholes.py 1.0 Dec 19, 2019
fitline.ipynb 2020.0.2 Jan 20, 2020
fitline.py 2020.0.1 Jan 8, 2020
flatarrow.py 1.0 Dec 19, 2019
glyphs.py 1.0 Dec 19, 2019
glyphs_arrows.py 2020.0.1 Jan 8, 2020
interactionstyle.py 1.0 Dec 19, 2019
isolines.py 2020.0.2 Jan 20, 2020
keypress.py 2020.0.1 Jan 8, 2020
kspline.py 1.0 Dec 19, 2019
largestregion.py 2020.0.2 Jan 20, 2020
lightings.py 1.0 Dec 19, 2019
lights.py 2020.0.1 Jan 8, 2020
linInterpolate.py 1.0 Dec 19, 2019
lorenz.py 1.0 Dec 19, 2019
manypoints.py 1.0 Dec 19, 2019
manyspheres.py 2020.0.2 Jan 20, 2020
mesh_alphas.py 2020.0.2 Jan 20, 2020
mesh_bands.py 2020.0.2 Jan 20, 2020
mesh_coloring.py 2020.0.1 Jan 8, 2020
mesh_custom.py 2020.0.2 Jan 20, 2020
mesh_lut.py 2020.0.1 Jan 8, 2020
mesh_map2cell.py 2020.0.2 Jan 20, 2020
mesh_modify.py 2020.0.1 Jan 8, 2020
mesh_sharemap.py 2020.0.1 Jan 8, 2020
mesh_threshold.py 2020.0.1 Jan 8, 2020
mirror.ipynb 2020.0.2 Jan 20, 2020
mirror.py 2020.0.2 Jan 20, 2020
mouseclick.py 2020.0.1 Jan 8, 2020
multiblocks.py 2020.0.1 Jan 8, 2020
multiwindows.py 2020.0.1 Jan 8, 2020
noname.ipynb 1.0 Dec 19, 2019
noname.py 1.0 Dec 19, 2019
pca.ipynb 2020.0.2 Jan 20, 2020
pca.py 2020.0.2 Jan 20, 2020
ribbon.py 2020.0.2 Jan 20, 2020
rotateImage.py 2020.0.2 Jan 20, 2020
run_all.sh 2020.0.2 Jan 20, 2020
scalarbars.py 2020.0.1 Jan 8, 2020
shadow.ipynb 2020.0.2 Jan 20, 2020
shadow.py 2020.0.2 Jan 20, 2020
shrink.ipynb 2020.0.2 Jan 20, 2020
shrink.py 2020.0.2 Jan 20, 2020
silhouette.py 2020.0.2 Jan 20, 2020
silhouette2.py 2020.0.2 Jan 20, 2020
slider_browser.py 2020.0.1 Jan 8, 2020
sliders.py 2020.0.2 Jan 20, 2020
sliders3d.py 2020.0.2 Jan 20, 2020
specular.py 1.0 Dec 19, 2019
surfIntersect.py 2020.0.2 Jan 20, 2020
texture_coords.py 2020.0.1 Jan 8, 2020
texturecubes.py 2020.0.2 Jan 20, 2020
trail.py 2020.0.2 Jan 20, 2020
tube.py 2020.0.2 Jan 20, 2020

README.md

Basic examples

In this directory you will find a set of examples to perform simple operations.

git clone https://github.com/marcomusy/vtkplotter-examples.git
cd vtkplotter/examples/basic
python example.py

(click thumbnail image to get to the python script)

align1
align1.py
Align two shapes by means of the Iterative Closest Point algorithm. Then for each vertex of the first object draw and arrow to the closest point of the second. The source transformation is saved in actor.info['transform'].
Setting rigid=True does not allow scaling.
align2
align2.py
Generate two random sets of points as two actors and align them using the Iterative Closest Point algorithm.
align3
align3py
Generate three random sets of points and align them using the Procrustes algorithm.
bgimage
bgImage.py
Set a background image on a vtkRenderingWindow layer.
boolean
boolean.py
Perform boolean operations with closed surfaces (e.g. plus, minus, intersect).
buttons
buttons.py
Add a square button with N possible internal states to a rendering window that calls a custom function.
clustering
clustering.py
Example of how to use removeOutliers() and cluster() methods.
colorcubes
colorcubes.py
Show a cube for each available color name.
colormaps
colormaps.py
Map a scalar to a color a point cloud with pointColors().
Available color maps are 'afmhot', 'binary', 'bone', 'cool', 'coolwarm', 'copper', 'gist_earth', 'gray', 'hot', 'jet', 'rainbow', 'winter'
connvtx
connVtx.py
Find the vertices that are connected to a specific vertex in a mesh.
customAxes
customAxes.py
Customize axes style with more than 30 controlling parameters.
cutter
cutter.py
Invoke an interactive tool to cut off parts of a mesh.
Pressing X saves the mesh to file or adds new cut planes.
delaunay2d
delaunay2d.py
Build a mesh starting from points in space using Delaunay triangulation (points must be projectable on the xy plane).
fitline
fitline.py
Draw a line in 3D that fits a cloud of points.
The example also fits a plane to the same points.
keypress
keypress.py
How to implement a custom function that is triggered by pressing a keyboard button when the rendering window is in interactive mode.
In the example, every time a key is pressed the picked point of the mesh is used to add a sphere and some info is printed.
largestregion
largestregion.py
Extract the mesh region that has the largest connected surface with method analysis.extractLargestRegion().
manyspheres
manyspheres.py
Draw a very large number of spheres (200.000) with different colors or different radii (for vtk versions before 8.0 this might be slow).
mesh_alphas
mesh_alphas.py
Create a set of transparencies which can be passed to method pointColors().
mesh_bands
mesh_bands.py
Use a scalar to paint colored bands on a mesh. This can be combined with opacities values for each vertex.
Keyword depthpeeling improves the rendering of translucent objects.
mesh_coloring
mesh_coloring.py
How to specify a color for each individual cell or point of an actors mesh.
The example also shows the usage of addScalarBar3D().
mesh_custom
mesh_custom.py
Build a custom color map to specify the color for each vertex of a mesh.
mesh_map2cell
mesh_map2cell.py
Map a scalar which is defined on the vertices to the mesh cells.
isolines
isolines.py
Generate isolines for the current active scalars of a surface.
mesh_threshold
mesh_threshold.py
Extracts the cells where scalar value satisfies a threshold criterion.
mirror
mirror.py
Mirror-reflect a mesh with respect to one of the cartesian axes.
mouseclick
mouseclick.py
A click of the mouse triggers a call to a custom function.
multiwindows
multiwindows.py
Drawing objects on different windows and/or subwindows within the same window.
Here we split the main window in a 25 subwindows and draw something on specific windows numbers. Then open a new independent window and draw a mesh on it.
pca
pca.py
Draw the PCA (Principal Component Analysis) ellipsoid that contains 50% of a cloud of points, then check how many points are indeed inside the surface.
Extra info is stored in actor.info['sphericity', 'va', 'vb', 'vc'].
ribbon
ribbon.py
Form a surface by joining two nearby lines in space.
flatarrow
flatarrow.py
Build a 2D arrow in 3D space defined by two nearby lines.
rotateimage
rotateImage.py
Normal jpg/png images can be loaded and rendered like any other actor.
shrink
shrink.py
Shrink the faces of a mesh to make the inside visible.
sliders
sliders.py
Use two sliders to modify interactively color and transparency of a mesh.
sliders3d
sliders3d.py
Use a 3D sliders to modify interactively the position of a mesh.
silhouette
silhouette.py
Show the silhouette of a mesh as seen along a specified direction.
shadow
shadow.py
Draw the shadow of a set of meshes on one of the Cartesian planes.
texturecubes
texturecubes.py
Show a cube for each available texture name. Any jpg file can be used as texture.
Built in textures: ['aqua', 'blue', 'bricks', 'gold1', 'gold2', 'grass', 'greenfloor', 'greentiles', 'ivy', 'leather1', 'leather2', 'marble', 'masonry', 'metal1', 'metal2', 'metalfloor1', 'metalfloor2', 'paper', 'water', 'white1', 'white2', 'white3', 'white4', 'wood1', 'wood2', 'wood3', 'wood4', 'wood5', 'wood6', 'wood7', 'wood8', 'wood9']
trail
trail.py
Add a trailing line to a moving actor.
tube
tube.py
Scalar arrays can be specified to vary radius and color of a line represented as a tube.
You can’t perform that action at this time.