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.
| Argument | Type | Required | Description |
|---|---|---|---|
publicAPI | Yes | object on which methods will be bounds (public) | |
model | Yes | object on which data structure will be bounds (protected) | |
initialValues | IPickerInitialValues | No |
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.
| Argument | Type | Required | Description |
|---|---|---|---|
pickedPositions | Array[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).
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | IPickerInitialValues | No | for 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.
| Argument | Type | Required | Description |
|---|---|---|---|
selection | Vector3 | Yes | First two values should be x-y pixel coordinate, the third is usually zero. |
renderer | vtkRenderer | Yes | The 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.
| Argument | Type | Required | Description |
|---|---|---|---|
selectionPoint | Vector3 | Yes | |
focalPoint | Vector3 | Yes | |
renderer | vtkRenderer | Yes |
setMapperPosition
Set position in mapper coordinates of pick point.
| Argument | Type | Required | Description |
|---|---|---|---|
x | Number | Yes | The x coordinate. |
y | Number | Yes | The y coordinate. |
z | Number | Yes | The z coordinate. |
setMapperPositionFrom
Set position in mapper coordinates of pick point.
| Argument | Type | Required | Description |
|---|---|---|---|
mapperPosition | Vector3 | Yes | The 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.)
| Argument | Type | Required | Description |
|---|---|---|---|
tolerance | Number | Yes | The tolerance value. |