5.7. 3D plot

5.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.

../_images/vtk3dvisualizer.png

Examples about the Vtk3dVisualizer plot can be found in the folder demo/plot.

5.7.1.1. Properties

cameraView : seq. of 3 floats

view direction of the camera

backgroundColor : color str, rgba or hex

background color of the canvas

toolbarVisible : bool

Toggles the visibility of the toolbar of the plot.

renderLegend : bool

If this property is true, the legend are included in pixelmaps renderings.

coordSysVisible : bool

sets the visibility of a coordinate system

pointCloud : QSharedPointer<ito::PCLPointCloud>

Sets the input point cloud for this plot.

yAxisLabel : str

Label of the y-axis.

propertiesSorted : bool

sort the properties of one item in an alphabetical order or not

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.

cameraFocalPoint : seq. of 3 floats

focal point of the camera

yAxisVisible : bool

Sets the visibility of the y-axis.

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)
colorMap : str

Color map (string) that should be used to colorize a non-color data object.

polygonMesh : QSharedPointer<ito::PCLPolygonMesh>

Sets the input polygon mesh for this plot.

xDrawGridlines : bool

Sets the visibility of gridlines along the x-axis.

cameraPosition : seq. of 3 floats

position of the camera

coordSysScale : float

sets the length / scaling of the coordinate axes

zAxisLabel : str

Label of the z-axis.

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].

pointPickSphereRadius : float

If > 0, a sphere with the given radius is printed around the center point of the point pick event (if enabled)

cubeGridlinesColor : color str, rgba or hex

sets the color of the cube gridlines

pointPickSphereColor : color str, rgba or hex

Color of the possible sphere of the point pick event (see pointPickShereRadius and enablePointPick)

xAxisTickVisibility : bool

Sets the visibility of major ticks along the x-axis.

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)
xAxisMinorTickVisibility : bool

Sets the visibility of minor ticks along the x-axis.

enableDistanceLOD : bool

If enabled the actor will not be visible at a certain distance from the camera

zDrawGridlines : bool

Sets the visibility of gridlines along the z-axis.

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].

yDrawGridlines : bool

Sets the visibility of gridlines along the y-axis.

cubeAxesVisible : bool

Overall visibility of the cube axes (must be set to True in order to see grids, labels, axes...)

cubeAxesColor : color str, rgba or hex

sets the color of the cube axes

parallelProjection : bool

if true a parallel projection is used, else the perspective projection

yAxisMinorTickVisibility : bool

Sets the visibility of minor ticks along the y-axis.

contextMenuEnabled : bool

Defines whether the context menu of the plot should be enabled or not.

xAxisVisible : bool

Sets the visibility of the x-axis.

showFPS : bool

shows the FPS counter or not

xAxisLabel : str

Label of the x-axis.

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)
coordSysPos : seq. of 3 floats

position of the coordinate system

dataObject : dataObject

Sets the input data object for this plot.

zAxisVisible : bool

Sets the visibility of the z-axis.

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].

zAxisMinorTickVisibility : bool

Sets the visibility of minor ticks along the z-axis.

enableViewAngleLOD : bool

If enabled the actor will not be visible at a certain view angle

zAxisTickVisibility : bool

Sets the visibility of major ticks along the z-axis.

yAxisTickVisibility : bool

Sets the visibility of major ticks along the y-axis.

5.7.1.2. Slots

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)

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)

setGeometriesPosition(names, positions) [slot]

changes the position of various geometries (arguments: list of keys, list of (pos_x, pos_y, pos_z)

setLinePlot(x0, y0, x1, y1, destID) [slot]

This (virtual) slot can be invoked by python to trigger a lineplot.

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)

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)

addSphere(point, radius, fullname, color, rgba or hex) [slot]

add a sphere (arguments: [center_x, center_y, center_z], radius, key, color = red]).

getPlotID() [slot]

Return window ID of this plot {int}.

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)

setPickPointMesh(mesh) [slot]

set mesh for pick point event. The cloud of the mesh is used only (arguments: mesh)

updatePointCloud(pcl, name, createIfNotExists) [slot]

updates an existing cloud (arguments: cloud, key, createIfNotExists=false)

addMesh(mesh, fullname) [slot]

add the given mesh to the tree with a key name (arguments: mesh, key)

registerModel(mesh, modelName) [slot]

see addMesh

deletePointCloud(name) [slot]

delete the cloud with key

deleteGeometry(name) [slot]

delete the geometry with key

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.

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)

addLines(points, fullname, color, rgba or hex) [slot]

add m lines to the canvas. The coordintates 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).

setItemProperty(name, property, value) [slot]

set the property of an item (arguments: key, property-name, value)

refreshPlot() [slot]

Triggers an update of the current plot window.

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)

deleteMesh(name) [slot]

delete the mesh with key

addPointCloud(pcl, name) [slot]

add the given cloud to the tree with a key name (arguments: cloud, key)

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)

addPointCloudNormal(pcl, fullname) [slot]

add the given cloud with normal vectors to the tree with a key name (arguments: cloud, key)

5.7.1.3. Signals

pointPicked(x, y, z, pointIndex) [signal]

signature for connection to this signal: pointPicked(float,float,float,int)