[vtkusers] Preset Views

Ted Christiansen ted at caept.com
Wed Sep 4 15:10:27 EDT 2002


Andres,

This is what am using, you can modify the values to suit.  Hope this
helps.

Ted

////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////

void CGraphicsView::OnViewLeft()
{
 double pdPosition[] = { -1,0,0 };
 double dUp[] = { 0, 1, 0 };

 vtkCamera *cam = Renderer->GetActiveCamera();

 cam->SetFocalPoint(0,0,0);

 pdPosition[0] =  -1;
 pdPosition[1] =  0;
 pdPosition[2] =  0;
 dUp[0] = 0;
 dUp[1] = 1;
 dUp[2] = 0;
 cam->SetViewUp(dUp);
 cam->SetPosition(pdPosition);
 cam->OrthogonalizeViewUp();

 Renderer->ResetCamera();
 Invalidate();

}


/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////

void CGraphicsView::OnViewIsometric()
{
 double pdPosition[] = { -1,0,0 };
 double dUp[] = { 0, 1, 0 };

 vtkCamera *cam = Renderer->GetActiveCamera();

 cam->SetFocalPoint(0,0,0);

 pdPosition[0] =  0;
 pdPosition[1] =  0;
 pdPosition[2] =  1;
 dUp[0] = 0;
 dUp[1] = 1;
 dUp[2] = 0;
 cam->SetViewUp(dUp);
 cam->SetPosition(pdPosition);
 cam->OrthogonalizeViewUp();
 cam->Elevation(35.26);
 cam->Azimuth(45);

 Renderer->ResetCamera();
 Invalidate();

}





More information about the vtkusers mailing list