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

Function getMotion

Interaction/Style/Testing/Python/TestStyleUser.py:57–74  ·  view source on GitHub ↗
(iRen,ren)

Source from the content-addressed store, hash-verified

55# This general method computes some common information from mouse
56# motion and button presses.
57def getMotion(iRen,ren):
58 global oldPickD, newPickD, oldPickW, newPickW, fpD, fpW, posW
59 global motionD, motionW, cam
60 style = iRen.GetInteractorStyle()
61 oldPickD = iRen.GetLastEventPosition()
62 newPickD = iRen.GetEventPosition()
63 motionD[0] = newPickD[0] - oldPickD[0];
64 motionD[1] = newPickD[1] - oldPickD[1];
65 cam = ren.GetActiveCamera()
66 fpW = cam.GetFocalPoint()
67 posW = cam.GetPosition()
68 style.ComputeWorldToDisplay(ren, fpW[0], fpW[1], fpW[2], fpD)
69 focalDepth = fpD[2]
70 style.ComputeDisplayToWorld(ren,oldPickD[0],oldPickD[1],focalDepth,oldPickW)
71 style.ComputeDisplayToWorld(ren,newPickD[0],newPickD[1],focalDepth,newPickW)
72 motionW[0] = oldPickW[0] - newPickW[0]
73 motionW[1] = oldPickW[1] - newPickW[1]
74 motionW[2] = oldPickW[2] - newPickW[2]
75
76# Left mouse button is pan
77def mouseLeftMove(iRen,ren):

Callers 3

mouseLeftMoveFunction · 0.85
mouseMiddleMoveFunction · 0.85
mouseRightMoveFunction · 0.85

Calls 5

GetActiveCameraMethod · 0.80
ComputeWorldToDisplayMethod · 0.80
ComputeDisplayToWorldMethod · 0.80
GetInteractorStyleMethod · 0.45
GetPositionMethod · 0.45

Tested by

no test coverage detected