MCPcopy Create free account
hub / github.com/MITK/MITK / MoveAlongAxis

Method MoveAlongAxis

Modules/Gizmo/src/mitkGizmoInteractor.cpp:213–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213void mitk::GizmoInteractor::MoveAlongAxis(StateMachineAction *, InteractionEvent *interactionEvent)
214{
215 auto positionEvent = dynamic_cast<const InteractionPositionEvent *>(interactionEvent);
216 if (positionEvent == nullptr)
217 {
218 return;
219 }
220
221 Point2D currentPosition2D = positionEvent->GetPointerPositionOnScreen();
222
223 // re-use the initial z value to calculate movements parallel to the camera plane
224 auto renderer = positionEvent->GetSender()->GetVtkRenderer();
225 renderer->SetDisplayPoint(currentPosition2D[0], currentPosition2D[1], m_InitialClickPosition2DZ);
226 renderer->DisplayToWorld();
227 vtkVector3d worldPointVTK(renderer->GetWorldPoint());
228 Point3D worldPointITK(worldPointVTK.GetData());
229 Vector3D freeMouseMovement3D(worldPointITK - m_InitialClickPosition3D);
230
231 double projectedMouseMovement3D = freeMouseMovement3D * m_AxisOfMovement;
232 Vector3D appliedMovement3D = projectedMouseMovement3D * m_AxisOfMovement;
233
234 ApplyTranslationToManipulatedObject(appliedMovement3D);
235 RenderingManager::GetInstance()->ForceImmediateUpdateAll();
236}
237
238void mitk::GizmoInteractor::RotateAroundAxis(StateMachineAction *, InteractionEvent *interactionEvent)
239{

Callers

nothing calls this directly

Calls 6

GetSenderMethod · 0.80
DisplayToWorldMethod · 0.80
GetVtkRendererMethod · 0.45
GetDataMethod · 0.45

Tested by

no test coverage detected