Re: Redraw

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed May 27 1998 - 08:13:40 MEST


Paul Nord wrote:
> 
> Forgive a new user if this is a silly question...
> How do I make it redraw a 3D object?
> 
> I'd like to create several buttons for "standard" detector views.  These
> buttons would then bring the rotation of the display to the end view, the top
> view, or the size view.
> 
> I can c1->GetView()->SetLatitude(0);
> But then c1->Draw(); doesn't change anything.  However c1->x3d();  Will then
> view with the new rotation setting.  And if you then quit x3d, the canvas will
> display in the new rotation.
> 
> Thanks,
> Paul Nord

I suggest you look into the ATLFast example at URL:
 http://root.cern.ch/root/Atlfast.html

You can download the source code and look in the class ATLFDisplay.
 http://root.cern.ch/root/html/atlfast/src/ATLFDisplay.cxx.html

An example of event with buttons producing a front/top/side/all view
is available at
  http://root.cern.ch/Pictures.html

The function below is extracted from ATLFDisplay. It is called
to set the viewing angles:

void ATLFDisplay::DrawView(Float_t theta, Float_t phi)
{
//    Draw a view of ATLAS

   gPad->SetFillColor(1);
   // Display ATLAS outline
   gPad->Clear();

   Int_t iret;
   TView *view = new TView(1);
   view->SetRange(-m_Rin, -m_Rin, -m_Zin, m_Rin, m_Rin, m_Zin);

   m_Nodin->Draw("same");

    // add itself to the list
   AppendPad();
   
   //Loop on all makers to add their products to the pad
   TIter next(gATLFast->Makers());
   ATLFMaker *maker;
   while ((maker = (ATLFMaker*)next())) {
      maker->Draw();
   }
   view->SetView(phi, theta, 0, iret);
}


Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:33 MET