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

Function pick

Rendering/Core/Testing/Python/pickCompositeData.py:209–239  ·  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,propPickData,pointPickData,cellPickData)

Source from the content-addressed store, hash-verified

207
208
209def pick(xy,propPickData,pointPickData,cellPickData):
210 """
211 Position the camera such that a ray through the screen center
212 points in z direction at position xy, and pick with vtkPicker,
213 vtkPointPicker and vtkCellPicker.
214 Returns the number of errors
215 """
216 size=rw.GetSize()
217 p=[size[0]/2,size[1]/2,0]
218
219 cam=r.GetActiveCamera()
220 cam.SetPosition(xy[0],xy[1],-10.0)
221 cam.SetFocalPoint(xy[0],xy[1],0.0)
222 cam.SetViewUp(0,1,0)
223 cam.SetViewAngle(90)
224 cam.ParallelProjectionOff()
225 r.ResetCameraClippingRange()
226 rw.Render()
227
228 errors = 0
229
230 if debug:
231 print('Picking at {}'.format(xy))
232 errors += propPick(p,xy,propPickData)
233 errors += pointPick(p,xy,pointPickData)
234 errors += cellPick(p,xy,cellPickData)
235
236 if debug:
237 time.sleep(3)
238
239 return errors
240
241
242# Run all of the tests defined by pickdata

Callers 1

Calls 13

propPickFunction · 0.85
pointPickFunction · 0.85
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

Tested by

no test coverage detected