Drawing TNode to TView

Takeaki Toeda (Takeaki.Toeda@cern.ch)
Tue, 20 Jul 99 19:20:20 +0200


Hello ROOTers,

I will ask about drawing TNode to TView.

Following is a my small drawing program to draw small box
and three axis. When I picked up the pad after drawing,
first view direction is changed to strange direction.
Do you know how to slove this problem?

And I have another question.
What is relation between phi and theta of TPad and of TView?

Thanks,

Take-Aki TOEDA

{
TMaterial *mat;
TMixture *mix;
TRotMatrix *rot;
TNode *Node;
Int_t irep;
Float_t Phi = 0,Theta=0;
Float_t xArray[] = {0,0,0,50,0,0};
Float_t yArray[] = {0,0,0,0,50,0};
Float_t zArray[] = {0,0,0,0,0,50};
mat = new TMaterial("mat","HYDROGEN",1.01,1,.0708);
TBRIK *BOX = new TBRIK("BOX","BOX","mat",10,10,10);

TCanvas *c1 = new TCanvas("c1","c1",200,300);
c1->Draw();
c1->cd();
TPad *pad1 = new TPad("pad1","pad1",0.,0.,1.,1.);
pad1->SetPhi(0);
pad1->SetTheta(0);
pad1->Draw();
pad1->cd();

TView *view = new TView(1);
view->SetRange(-100,-100,-100,100,100,100);

Node = new TNode("Node","Node",BOX,0,0,0);

TPolyLine3D *xAxis = new TPolyLine3D(2,xArray);
xAxis->SetLineColor(4); // blue

TPolyLine3D *yAxis = new TPolyLine3D(2,yArray);
yAxis->SetLineColor(5); // yellow

TPolyLine3D *zAxis = new TPolyLine3D(2,zArray);
zAxis->SetLineColor(7); // sky blue

Node->Draw("same");
xAxis->Draw("same");
yAxis->Draw("same");
zAxis->Draw("same");
view->SetView(Phi,Theta,0.,irep);

Float_t x = view->GetLongitude();
Float_t y = view->GetLatitude();
printf("Longitude = %f\n",x);
printf("Latitude = %f\n",y);

}