| 205 | } |
| 206 | |
| 207 | void mitk::ClippingPlaneInteractor3D::RotateObject(StateMachineAction *, InteractionEvent *interactionEvent) |
| 208 | { |
| 209 | auto *positionEvent = dynamic_cast<InteractionPositionEvent *>(interactionEvent); |
| 210 | if (positionEvent == nullptr) |
| 211 | return; |
| 212 | |
| 213 | double currentWorldPoint[4]; |
| 214 | Point2D currentPickedDisplayPoint = positionEvent->GetPointerPositionOnScreen(); |
| 215 | vtkInteractorObserver::ComputeDisplayToWorld(interactionEvent->GetSender()->GetVtkRenderer(), |
| 216 | currentPickedDisplayPoint[0], |
| 217 | currentPickedDisplayPoint[1], |
| 218 | 0.0, // m_InitialInteractionPickedPoint[2], |
| 219 | currentWorldPoint); |
| 220 | |
| 221 | vtkCamera *camera = nullptr; |
| 222 | vtkRenderer *currentVtkRenderer = nullptr; |
| 223 | |
| 224 | if ((interactionEvent->GetSender()) != nullptr) |
| 225 | { |
| 226 | vtkRenderWindow *renderWindow = interactionEvent->GetSender()->GetRenderWindow(); |
| 227 | if (renderWindow != nullptr) |
| 228 | { |
| 229 | vtkRenderWindowInteractor *renderWindowInteractor = renderWindow->GetInteractor(); |
| 230 | if (renderWindowInteractor != nullptr) |
| 231 | { |
| 232 | currentVtkRenderer = renderWindowInteractor->GetInteractorStyle()->GetCurrentRenderer(); |
| 233 | if (currentVtkRenderer != nullptr) |
| 234 | camera = currentVtkRenderer->GetActiveCamera(); |
| 235 | } |
| 236 | } |
| 237 | } |
| 238 | if (camera) |
| 239 | { |
| 240 | double vpn[3]; |
| 241 | camera->GetViewPlaneNormal(vpn); |
| 242 | |
| 243 | Vector3D viewPlaneNormal; |
| 244 | viewPlaneNormal[0] = vpn[0]; |
| 245 | viewPlaneNormal[1] = vpn[1]; |
| 246 | viewPlaneNormal[2] = vpn[2]; |
| 247 | |
| 248 | Vector3D interactionMove; |
| 249 | interactionMove[0] = currentWorldPoint[0] - m_InitialPickedWorldPoint[0]; |
| 250 | interactionMove[1] = currentWorldPoint[1] - m_InitialPickedWorldPoint[1]; |
| 251 | interactionMove[2] = currentWorldPoint[2] - m_InitialPickedWorldPoint[2]; |
| 252 | |
| 253 | if (interactionMove[0] == 0 && interactionMove[1] == 0 && interactionMove[2] == 0) |
| 254 | return; |
| 255 | |
| 256 | Vector3D rotationAxis = itk::CrossProduct(viewPlaneNormal, interactionMove); |
| 257 | rotationAxis.Normalize(); |
| 258 | |
| 259 | int *size = currentVtkRenderer->GetSize(); |
| 260 | double l2 = (currentPickedDisplayPoint[0] - m_InitialPickedDisplayPoint[0]) * |
| 261 | (currentPickedDisplayPoint[0] - m_InitialPickedDisplayPoint[0]) + |
| 262 | (currentPickedDisplayPoint[1] - m_InitialPickedDisplayPoint[1]) * |
| 263 | (currentPickedDisplayPoint[1] - m_InitialPickedDisplayPoint[1]); |
| 264 |
nothing calls this directly
no test coverage detected