TView::WCtoNDC

From: Dmitri Litvintsev (litvinse@cdfsga.fnal.gov)
Date: Sat Sep 25 1999 - 20:35:10 MEST


Hi Rooters, 

	I've noticed that TView's ctor resets range of TPad 
to (-1,-1,1,1). I didn't quite like it and created MyView, 
which inherits from TView and does not reset TPad's range. 
To draw various 3D primitives I need to override TView::WCtoNDC
method like this:

xn[0] *= fPadX2-fPadX1; xn[0] += 0.5*(fPadX2+fPadX1);
xn[1] *= fPadY2-fPadY1; xn[1] += 0.5*(fPadY2+fPadY1);

works fine, but... 

suppose I draw TSPHE with radius 100 and centered at (0,0,0)
(TPad range is set properly, i.g. like (-200,-200,200,200))
so I invoke something like this:
{
 TCanvas* c = new TCanvas("canvas","canvas",0,0,500,500);
 c->cd();
 TPad* pad = new TPad("pad","pad",0,0,1,1);
 pad->Range(-200,-200,200,200);
 pad->Draw();
 pad->cd();
 TEllipse* el = new TEllipse(0,0,100);
 el->Draw();
 Float_t rMin[3] = { -200, -200, -200 };
 Float_t rMax[3] = { 200, 200, 200 }; 
 MyView* view = new MyView(rMin,rMax,1);
 view->SetRange(rMin,rMax);
 TSPHE* sphe = new TSPHE("SPHE","SPHE","void",0.,100., 0, 180, 0,360); 
 TNode* node = new TNode("NODE","NODE","SPHE",0,0,0);
 node->SetLineColor(3);
 node->Draw("same");
}

to my surprise visible radius of Sphere is less then 100. (ellipse and 
sphere don't coinside) 
there is some 'coefficient' approximately 1.16, which being used like this
in MyView::WCtNDC:

xn[0] *= (fPadX2-fPadX1)/1.16; xn[0] += 0.5*(fPadX2+fPadX1);
xn[1] *= (fPadY2-fPadY1)/1.16; xn[1] += 0.5*(fPadY2+fPadY1);

gives more satisfactory result.
Could you please hint me where this number comes from? May be I'd
be able to get exact number (not use the result of my 'measurement')


Dmitri Litvintsev

/----------------------------------------------------------\
| Tel:       (630) 840 3763                                |  
| FAX:       (630) 840 2968                                |      
| office:    164-O CDF Trailers                            |
| E-mail:    litvinse@fnal.gov                             |
\----------------------------------------------------------/



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