Hello Andre,
>
> (please cc me in the replies)
>
> Hi,
>
> There are two things I really do not understand about the above items:
>
> 1.- How to rotate a TCanvas about the xx, yy and zz axis using its
> TView. I do not understand very well the role of the psi angle in
> SetView(), although long and lat work fine. If it is just my
> trigonometry, then please send me to RTFM.
It seems to me by some reason TView can be rotated interactively around
2 axes only.
> 2.- More interesting: I'd like to set a canvas view based on which
ever
> view the user sets on the I believe this is very useful. Otherwise
> whenever I Modify() the Canvas, I get the old view in the GL viewer.
Any
> chances I can derive a TView info from the TPadOpenGLView?
Please check the piece of the code below. It shows how TView can be
updated
properly. I am finishing a new version of 3D viewers as part of my Qt-
exercises. I hope there things will be clearer (see: http://root.bnl.gov
)
The code below from there.
Check the method RotateView from the ROOT macro:
http://www.star.bnl.gov/cgi-bin/cvsweb.cgi/StRoot/macros/graphics/PadCon
trolPanel.C?rev=1.17&content-type=text/x-cvsweb-markup
You can download the macro and run. It should work with any current
TPad/TCanvas right away.
Hope this helps.
Valeri
void TQtViewerX3D::SetPadView(float longitude_rad, float latitude_rad,
float psi_rad)
{
// Qt slot:
// Adjust TPad view according the last 3D view position
if (fPad) {
const Float_t kPI = Float_t (TMath::Pi());
Int_t irep;
Float_t longitude_deg = longitude_rad * 180.0/kPI - 90;
Float_t latitude_deg = latitude_rad * 180.0/kPI + 90;
Float_t psi_deg = psi_rad * 180.0/kPI;
fPad->GetView()->SetView(longitude_deg, latitude_deg, psi_deg,
irep);
fPad->SetPhi(-90 - longitude_deg);
fPad->SetTheta(90 - latitude_deg);
fPad->Modified(kTRUE);
fPad->Update();
}
}
>
> Thanks for any help,
>
> Andre David
> --
> `-----------------------------------
> Andre David +41227676147
> CERN-EP-NA60 +41792013849
> Geneva, Switzerland
>
>
> --
> `-----------------------------------
> Andre David +41227676147
> CERN-EP-NA60 +41792013849
> Geneva, Switzerland
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:08 MET