Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.md jupyter support May 28, 2019
a_first_example.py jupyter support May 28, 2019
acollection.ipynb 4.3 Aug 19, 2019
acollection.py vers bump Mar 11, 2019
align1.ipynb 4.3 Aug 19, 2019
align1.py 4.3 Aug 19, 2019
align2.ipynb 4.3 Aug 19, 2019
align2.py 4.3 Aug 19, 2019
align3.py probepoints Apr 9, 2019
annotations.py fixes Mar 27, 2019
bgImage.py 4.2 Aug 13, 2019
boolean.py 4.2 Aug 13, 2019
buildmesh.ipynb 4.3 Aug 19, 2019
buildmesh.py 4.0 Jul 17, 2019
buttons.py jupyter support May 28, 2019
carcrash.py 4.0 Jul 17, 2019
closewindow.py Typo update for examples/basic/closewindow.py May 21, 2019
clustering.ipynb 4.3 Aug 19, 2019
clustering.py 3.4 Jun 24, 2019
colorMeshCells.py 4.2 Aug 13, 2019
colorcubes.py 4.3 Aug 19, 2019
colormaps.py 4.3 Aug 19, 2019
connCells.py 4.3 Aug 19, 2019
connVtx.ipynb 4.3 Aug 19, 2019
connVtx.py 4.0 Jul 17, 2019
customAxes.py jupyter support May 28, 2019
cutter.py 3.0 May 16, 2019
delaunay2d.py 4.3 Aug 19, 2019
deleteMeshPoints.py fixes Jun 22, 2019
distance2mesh.ipynb 4.3 Aug 19, 2019
distance2mesh.py 4.2 Aug 13, 2019
fillholes.py 4.0 Jul 17, 2019
fitline.ipynb 4.0 Jul 17, 2019
fitline.py jupyter support May 28, 2019
flatarrow.py Removed trailing spaces in examples/basic/flatarrow.py May 21, 2019
fonts.py 2.2 May 13, 2019
fxy.ipynb 4.3 Aug 19, 2019
fxy.py 4.0 Jul 17, 2019
glyphs.py 3.5 Jul 3, 2019
glyphs_arrows.py 4.3 Aug 19, 2019
histo2D.py 2.2 May 13, 2019
interactionstyle.py vers bump Mar 11, 2019
isolines.py 4.3 Aug 19, 2019
keypress.py 4.3 Aug 19, 2019
largestregion.py 3.0 May 16, 2019
latex.py 1.5 Apr 24, 2019
lightings.py 4.3 Aug 19, 2019
lights.py 4.1 Aug 4, 2019
lorenz.py 4.1 Aug 4, 2019
manypoints.py 4.1 Aug 4, 2019
manyspheres.py Removed trailigit add examplesic/manyspheres.py May 21, 2019
markpoint.py 4.0 Jul 17, 2019
mesh_alphas.py 4.3 Aug 19, 2019
mesh_bands.py 4.3 Aug 19, 2019
mesh_coloring.py 4.3 Aug 19, 2019
mesh_custom.py 4.3 Aug 19, 2019
mesh_map2cell.py 4.3 Aug 19, 2019
mesh_modify.py 4.3 Aug 19, 2019
mesh_sharemap.py 4.3 Aug 19, 2019
mesh_threshold.py 4.3 Aug 19, 2019
mirror.ipynb 4.2 Aug 13, 2019
mirror.py 2.0 May 6, 2019
mouseclick.py 3.5 Jul 3, 2019
multiblocks.py 4.3 Aug 19, 2019
multiwindows.py Removed trailing spaces in examples/basic/multiwindows.py May 21, 2019
numpy2picture.py 4.2 Aug 13, 2019
pca.ipynb 4.3 Aug 19, 2019
pca.py jupiter support May 28, 2019
ribbon.py 4.0 Jul 17, 2019
rotateImage.py jupyter support May 28, 2019
scalarbars.py 4.3 Aug 19, 2019
shadow.ipynb 4.3 Aug 19, 2019
shadow.py 2.2 May 13, 2019
shrink.ipynb 4.3 Aug 19, 2019
shrink.py 2.0 May 6, 2019
silhouette.py fix text2d Jun 17, 2019
slider_browser.py 4.1 Aug 4, 2019
sliders.py fix text2d Jun 17, 2019
sliders3d.py 2.0 May 6, 2019
specular.py jupyter support May 28, 2019
surfIntersect.py 4.0 Jul 17, 2019
text_just.py 3.3 Jun 11, 2019
texturecubes.py 1.6 Apr 30, 2019
trail.py fix text2d Jun 17, 2019
tube.py Removed trailing spaces in examples/basic/tube.py May 21, 2019

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.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.
carcrash
carcrash.py
Make a textured floor, a lamp post, load the mesh of a car, make copies of it, rotate and move them in a loop.
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.
fxy
fxy.py
Draw a surface representing a function f(x, y) defined as a string/formula or as a reference to an external already existing function.
Red points indicate where the function does not exist.
histo2d
histo2D.py
Make a histogram of two variables with hexagonal binning.
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().
latex
latex.py
Draw latex formatted text on the rendering window.
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.