Skip to content

Picker

Introduction

vtkPicker is used to select instances of vtkProp3D by shooting a ray into a graphics window and intersecting with the actor's bounding box. The ray is defined from a point defined in window (or pixel) coordinates, and a point located from the camera's position.

vtkPicker may return more than one vtkProp3D, since more than one bounding box may be intersected. vtkPicker returns an unsorted list of props that were hit, and a list of the corresponding world points of the hits. For the vtkProp3D that is closest to the camera, vtkPicker returns the pick coordinates in world and untransformed mapper space, the prop itself, the data set, and the mapper. For vtkPicker the closest prop is the one whose center point (i.e., center of bounding box) projected on the view ray is closest to the camera. Subclasses of vtkPicker use other methods for computing the pick point.

vtkPicker is used for quick geometric picking. If you desire more precise picking of points or cells based on the geometry of any vtkProp3D, use the subclasses vtkPointPicker or vtkCellPicker. For hardware-accelerated picking of any type of vtkProp, use vtkPropPicker or vtkWorldPointPicker.

Note that only vtkProp3D's can be picked by vtkPicker.

Methods

extend

Method use to decorate a given object (publicAPI+model) with vtkRenderer characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesIPickerInitialValuesNo

getActors

Get a collection of all the actors that were intersected.

getDataSet

Get the dataset that was picked (if any).

getMapper

Get mapper that was picked (if any)

getMapperPosition

Get position in mapper (i.e., non-transformed) coordinates of pick point.

getMapperPositionByReference

Get position in mapper (i.e., non-transformed) coordinates of pick point.

getPickedPositions

Get a list of the points the actors returned by getActors were intersected at.

getTolerance

Get tolerance for performing pick operation.

invokePickChange

Invoke a pick change event with the list of picked points. This function is called internally by VTK.js and is not intended for public use.

ArgumentTypeRequiredDescription
pickedPositionsArray[Vector3]Yes

newInstance

Method use to create a new instance of vtkPicker with its focal point at the origin, and position=(0,0,1). The view up is along the y-axis, view angle is 30 degrees, and the clipping range is (.1,1000).

ArgumentTypeRequiredDescription
initialValuesIPickerInitialValuesNofor pre-setting some of its content

onPickChange

Execute the given callback when the pickChange event is fired. The callback receives an array of picked point positions.

pick

Perform pick operation with selection point provided.

ArgumentTypeRequiredDescription
selectionVector3YesFirst two values should be x-y pixel coordinate, the third is usually zero.
renderervtkRendererYesThe renderer on which you want to do picking.

pick3DPoint

Perform pick operation with the provided selection and focal points. Both point are in world coordinates.

ArgumentTypeRequiredDescription
selectionPointVector3Yes
focalPointVector3Yes
renderervtkRendererYes

setMapperPosition

Set position in mapper coordinates of pick point.

ArgumentTypeRequiredDescription
xNumberYesThe x coordinate.
yNumberYesThe y coordinate.
zNumberYesThe z coordinate.

setMapperPositionFrom

Set position in mapper coordinates of pick point.

ArgumentTypeRequiredDescription
mapperPositionVector3YesThe mapper coordinates of pick point.

setTolerance

Specify tolerance for performing pick operation. Tolerance is specified as fraction of rendering window size. (Rendering window size is measured across diagonal.)

ArgumentTypeRequiredDescription
toleranceNumberYesThe tolerance value.