6.7. 3D plot#
6.7.1. Vtk3dVisualizer#
The Vtk3dVisualizer designer plugin can be used to display arbitrary point clouds, polygonal meshes or geometric shapes like
cylinders, spheres, pyramids, lines or cubes in one 3D plot. The first point cloud or polygonal mesh is plotted using the
default plot()
command. Further items are added, updated or removed by several slots that are defined and can be
called using the method call()
.
Every item on the canvas is listed in a tree view representation using the optional name of each item. Additionally, every item can be configured independently (for more information see the example demo/plot/demoVtk3dVisualizer.py or demo/plot/cloudAndMeshVisualization.py.
Examples about the Vtk3dVisualizer plot can be found in the folder demo/plot.
Note
Newer versions of VTK (compiled with OpenGL 2) might not work via a remote desktop connection under Windows, since newer OpenGL standards are not supported by remote desktop.
6.7.1.1. Properties#
- cameraFocalPoint : seq. of 3 floats
focal point of the camera
- cameraView : seq. of 3 floats
view direction of the camera
- cameraPosition : seq. of 3 floats
position of the camera
- coordSysPos : seq. of 3 floats
position of the coordinate system
- parallelProjection : bool
if true a parallel projection is used, else the perspective projection
- coordSysVisible : bool
sets the visibility of a coordinate system
- coordSysScale : float
sets the length / scaling of the coordinate axes
- stereoType : Stereo
sets the stereo type of the canvas
The type ‘Stereo’ is an enumeration that can have one of the following values (str or int):
‘No’ (0)
‘CrystalEyes’ (1)
‘RedBlue’ (2)
‘Interlaced’ (3)
‘Left’ (4)
‘Right’ (5)
‘Dresden’ (6)
‘Anaglyph’ (7)
‘Checkerboard’ (8)
- showFPS : bool
shows the FPS counter or not
- backgroundColor : color str, rgba or hex
background color of the canvas
- zAxisMinorTickVisibility : bool
Sets the visibility of minor ticks along the z-axis.
- yAxisMinorTickVisibility : bool
Sets the visibility of minor ticks along the y-axis.
- xAxisMinorTickVisibility : bool
Sets the visibility of minor ticks along the x-axis.
- zAxisTickVisibility : bool
Sets the visibility of major ticks along the z-axis.
- yAxisTickVisibility : bool
Sets the visibility of major ticks along the y-axis.
- xAxisTickVisibility : bool
Sets the visibility of major ticks along the x-axis.
- zDrawGridlines : bool
Sets the visibility of gridlines along the z-axis.
- yDrawGridlines : bool
Sets the visibility of gridlines along the y-axis.
- xDrawGridlines : bool
Sets the visibility of gridlines along the x-axis.
- zAxisVisible : bool
Sets the visibility of the z-axis.
- yAxisVisible : bool
Sets the visibility of the y-axis.
- xAxisVisible : bool
Sets the visibility of the x-axis.
- zAxisLabel : str
Label of the z-axis.
- yAxisLabel : str
Label of the y-axis.
- xAxisLabel : str
Label of the x-axis.
- enableViewAngleLOD : bool
If enabled the actor will not be visible at a certain view angle
- enableDistanceLOD : bool
If enabled the actor will not be visible at a certain distance from the camera
- cubeAxesTickLocation : TickLocation
defines the location of ticks for the cube axes
The type ‘TickLocation’ is an enumeration that can have one of the following values (str or int):
‘ticksInside’ (0)
‘ticksOutside’ (1)
‘ticksBoth’ (2)
- cubeAxesFlyMode : FlyMode
defines how the cube axes are positioned depending on the current camera
The type ‘FlyMode’ is an enumeration that can have one of the following values (str or int):
‘flyOuterEdges’ (0)
‘flyClostestTriad’ (1)
‘flyFurthestTriad’ (2)
‘flyStaticTriad’ (3)
‘flyStaticEdges’ (4)
- cubeGridlinesColor : color str, rgba or hex
sets the color of the cube gridlines
- cubeAxesColor : color str, rgba or hex
sets the color of the cube axes
- cubeAxesVisible : bool
Overall visibility of the cube axes (must be set to True in order to see grids, labels, axes…)
- pointPickSphereColor : color str, rgba or hex
Color of the possible sphere of the point pick event (see pointPickShereRadius and enablePointPick)
- pointPickSphereRadius : float
If > 0, a sphere with the given radius is printed around the center point of the point pick event (if enabled)
- enablePointPick : bool
if True, a click to any point of the canvas emits the signal pointPicked that emits the currently clicked 3d coordinate and the index of the closest point of the cloud / mesh that has been given as pickPointCloud or pickMesh.
- propertiesSorted : bool
sort the properties of one item in an alphabetical order or not
- colorMap : str
Color map (string) that should be used to colorize a non-color data object.
- zAxisInterval : autoInterval
Sets the visible range of the displayed z-axis (in coordinates of the data object) or (0.0, 0.0) if range should be automatically set [default].
- yAxisInterval : autoInterval
Sets the visible range of the displayed y-axis (in coordinates of the data object) or (0.0, 0.0) if range should be automatically set [default].
- xAxisInterval : autoInterval
Sets the visible range of the displayed x-axis (in coordinates of the data object) or (0.0, 0.0) if range should be automatically set [default].
- polygonMesh : QSharedPointer<ito::PCLPolygonMesh>
Sets the input polygon mesh for this plot.
- pointCloud : QSharedPointer<ito::PCLPointCloud>
Sets the input point cloud for this plot.
- dataObject : dataObject
Sets the input data object for this plot.
- renderLegend : bool
If this property is true, the legend are included in pixelmaps renderings.
- contextMenuEnabled : bool
Defines whether the context menu of the plot should be enabled or not.
- toolbarVisible : bool
Toggles the visibility of the toolbar of the plot.
6.7.1.2. Slots#
- setPickPointMesh(mesh) [slot]
set mesh for pick point event. The cloud of the mesh is used only (arguments: mesh)
- setPickPointCloud(pcl) [slot]
set cloud for pick point event. Nearest point from the position of the cursor (x,y,z) position is searched (arguments: cloud)
- setItemProperty(name, property, value) [slot]
set the property of an item (arguments: key, property-name, value)
- setGeometriesPosition(names, positions) [slot]
changes the position of various geometries (arguments: list of keys, list of (pos_x, pos_y, pos_z)
- setGeometryPose(name, translation, rotation) [slot]
moves and/or rotates a given geometry (arguments: key, (t_x, t_y, t_z), (r_x, r_y, r_z)
- deleteGeometry(name) [slot]
delete the geometry with key
- deleteMesh(name) [slot]
delete the mesh with key
- deletePointCloud(name) [slot]
delete the cloud with key
- updateText(text, x, y, fontsize, name, color, rgba or hex, createIfNotExists) [slot]
updates or creates new 2d text (arguments: text, x, y, fontsize, key, color = white, createIfNotExists = false)
- addText(text, x, y, fontsize, fullname, color, rgba or hex) [slot]
add a 2d text to a specific position (arguments: text, x, y, fontsize, key, color = white)
- addPolygon(points, fullname, color, rgba or hex) [slot]
adds a 2d polygon (arguments: points, key, color = white) where points is a Mx3 data object where each line is the (x,y,z) coordinate of a point of the polygon. The point values will internally be converted to float32.
- addSphere(point, radius, fullname, color, rgba or hex) [slot]
add a sphere (arguments: [center_x, center_y, center_z], radius, key, color = red]).
- addLines(points, fullname, color, rgba or hex) [slot]
add m lines to the canvas. The coordinates are given by a float32 data object [m x 6] where one row is (x0,y0,z0,x1,y1,z1) (arguments: points, key, color=red).
- addCube(size, translation, rotation, fullname, color, rgba or hex) [slot]
add cube (arguments: [size_x, size_y, size_z], [t_x, t_y, t_z], [r_x, r_y, r_z], key, color=white)
- addCuboid(points, fullname, color, rgba or hex) [slot]
add cube. The 8 corner points are given in a 3x8 data object (arguments: points, key, color=white)
- addPyramid(points, fullname, color, rgba or hex) [slot]
add pyramid. The 5 corner points are given in a 3x5 data object (arguments: points, key, color=white)
- addCylinder(point, orientation, radius, fullname, color, rgba or hex) [slot]
add a cylinder (arguments: (center_x, center_y, center_y), (orientation_x, orientation_y, orientation_z), radius, key, color=white)
- updatePointCloud(pcl, name, createIfNotExists) [slot]
updates an existing cloud (arguments: cloud, key, createIfNotExists=false)
- addPointCloudNormal(pcl, fullname) [slot]
add the given cloud with normal vectors to the tree with a key name (arguments: cloud, key)
- addPointCloud(pcl, name) [slot]
add the given cloud to the tree with a key name (arguments: cloud, key)
- addMesh(mesh, fullname) [slot]
add the given mesh to the tree with a key name (arguments: mesh, key)
- registerModel(mesh, modelName) [slot]
see addMesh
- setLinePlot(x0, y0, x1, y1, destID) [slot]
This (virtual) slot can be invoked by python to trigger a lineplot.
- refreshPlot() [slot]
Triggers an update of the current plot window.
- getPlotID() [slot]
Return window ID of this plot {int}.
6.7.1.3. Signals#
- pointPicked(x, y, z, pointIndex) [signal]
signature for connection to this signal: pointPicked(float,float,float,int)
- windowTitleModified(windowTitleSuffix) [signal]
signature for connection to this signal: windowTitleModified(QString)