MCPcopy Create free account
hub / github.com/Kitware/VTK / pick

Function pick

Rendering/Core/Testing/Python/pickCompositeData2.py:201–228  ·  view source on GitHub ↗

Position the camera such that a ray through the screen center points in z direction at position xy, and pick with vtkPicker, vtkPointPicker and vtkCellPicker. Returns the number of errors

(xy,cellPickData)

Source from the content-addressed store, hash-verified

199
200
201def pick(xy,cellPickData):
202 """
203 Position the camera such that a ray through the screen center
204 points in z direction at position xy, and pick with vtkPicker,
205 vtkPointPicker and vtkCellPicker.
206 Returns the number of errors
207 """
208 size=rw.GetSize()
209 p=[size[0]/2,size[1]/2,0]
210
211 cam=r.GetActiveCamera()
212 cam.SetPosition(xy[0],xy[1],2.0)
213 cam.SetFocalPoint(xy[0],xy[1],0.0)
214 cam.SetViewUp(0,1,0)
215 cam.SetViewAngle(35)
216 cam.ParallelProjectionOn()
217 r.ResetCameraClippingRange()
218 rw.Render()
219
220 if debug:
221 print('Picking at {0}'.format(xy))
222
223 errors = cellPick(p,xy,cellPickData)
224
225 if debug:
226 time.sleep(2)
227
228 return errors
229
230
231# Run all of the tests defined by pickdata

Callers 1

Calls 11

GetActiveCameraMethod · 0.80
SetViewUpMethod · 0.80
SetViewAngleMethod · 0.80
cellPickFunction · 0.70
RenderMethod · 0.65
printFunction · 0.50
GetSizeMethod · 0.45
SetPositionMethod · 0.45
SetFocalPointMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected