------------------------------------------------------------------------------
| 363 | |
| 364 | //------------------------------------------------------------------------------ |
| 365 | void vtkInteractorStyleTrackballActor::Pan() |
| 366 | { |
| 367 | if (this->CurrentRenderer == nullptr || this->InteractionProp == nullptr) |
| 368 | { |
| 369 | return; |
| 370 | } |
| 371 | |
| 372 | vtkRenderWindowInteractor* rwi = this->Interactor; |
| 373 | |
| 374 | // Use initial center as the origin from which to pan |
| 375 | |
| 376 | double* obj_center = this->InteractionProp->GetCenter(); |
| 377 | |
| 378 | double disp_obj_center[3], new_pick_point[4]; |
| 379 | double old_pick_point[4], motion_vector[3]; |
| 380 | |
| 381 | this->ComputeWorldToDisplay(obj_center[0], obj_center[1], obj_center[2], disp_obj_center); |
| 382 | |
| 383 | this->ComputeDisplayToWorld( |
| 384 | rwi->GetEventPosition()[0], rwi->GetEventPosition()[1], disp_obj_center[2], new_pick_point); |
| 385 | |
| 386 | this->ComputeDisplayToWorld(rwi->GetLastEventPosition()[0], rwi->GetLastEventPosition()[1], |
| 387 | disp_obj_center[2], old_pick_point); |
| 388 | |
| 389 | motion_vector[0] = new_pick_point[0] - old_pick_point[0]; |
| 390 | motion_vector[1] = new_pick_point[1] - old_pick_point[1]; |
| 391 | motion_vector[2] = new_pick_point[2] - old_pick_point[2]; |
| 392 | |
| 393 | if (this->InteractionProp->GetUserMatrix() != nullptr) |
| 394 | { |
| 395 | vtkTransform* t = vtkTransform::New(); |
| 396 | t->PostMultiply(); |
| 397 | t->SetMatrix(this->InteractionProp->GetUserMatrix()); |
| 398 | t->Translate(motion_vector[0], motion_vector[1], motion_vector[2]); |
| 399 | this->InteractionProp->GetUserMatrix()->DeepCopy(t->GetMatrix()); |
| 400 | t->Delete(); |
| 401 | } |
| 402 | else |
| 403 | { |
| 404 | this->InteractionProp->AddPosition(motion_vector[0], motion_vector[1], motion_vector[2]); |
| 405 | } |
| 406 | |
| 407 | if (this->AutoAdjustCameraClippingRange) |
| 408 | { |
| 409 | this->CurrentRenderer->ResetCameraClippingRange(); |
| 410 | } |
| 411 | |
| 412 | rwi->Render(); |
| 413 | } |
| 414 | |
| 415 | //------------------------------------------------------------------------------ |
| 416 | void vtkInteractorStyleTrackballActor::Dolly() |
no test coverage detected