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

Method FlyToImage

Rendering/Core/vtkRenderWindowInteractor.cxx:468–500  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

466
467//------------------------------------------------------------------------------
468void vtkRenderWindowInteractor::FlyToImage(vtkRenderer* ren, double x, double y)
469{
470 double flyFrom[3], flyTo[3];
471 double d[3], focalPt[3], position[3], positionFrom[3];
472 int i, j;
473
474 flyTo[0] = x;
475 flyTo[1] = y;
476 ren->GetActiveCamera()->GetFocalPoint(flyFrom);
477 flyTo[2] = flyFrom[2];
478 ren->GetActiveCamera()->GetPosition(positionFrom);
479 for (i = 0; i < 2; i++)
480 {
481 d[i] = flyTo[i] - flyFrom[i];
482 }
483 d[2] = 0.0;
484 double distance = vtkMath::Normalize(d);
485 double delta = distance / this->NumberOfFlyFrames;
486
487 for (i = 1; i <= NumberOfFlyFrames; i++)
488 {
489 for (j = 0; j < 3; j++)
490 {
491 focalPt[j] = flyFrom[j] + d[j] * i * delta;
492 position[j] = positionFrom[j] + d[j] * i * delta;
493 }
494 ren->GetActiveCamera()->SetFocalPoint(focalPt);
495 ren->GetActiveCamera()->SetPosition(position);
496 ren->GetActiveCamera()->Dolly(this->Dolly / this->NumberOfFlyFrames + 1.0);
497 ren->ResetCameraClippingRange();
498 this->Render();
499 }
500}
501
502//------------------------------------------------------------------------------
503vtkRenderer* vtkRenderWindowInteractor::FindPokedRenderer(int x, int y)

Callers 2

OnCharMethod · 0.80
FlyToImageFunction · 0.80

Calls 8

RenderMethod · 0.95
GetActiveCameraMethod · 0.80
NormalizeFunction · 0.50
GetPositionMethod · 0.45
SetFocalPointMethod · 0.45
SetPositionMethod · 0.45
DollyMethod · 0.45

Tested by

no test coverage detected