Re: Markers in the viewers

Rene Brun (Rene.Brun@cern.ch)
Thu, 20 May 1999 17:08:31 +0000


Tioukov Valeri wrote:
>
> Hi rooters,
>
> Trying to draw my hits, tracks and vertex what is essentualy combination
> of TPolyLine3D and TPolyMarker3D I made the following observations about
> X3D and OpenGL viewers.
> Are there correct or not?
>
> If I have TPolyMarker3D on the picture
>
> - the marker style do not correlate to the declared one:
> OpenGL alwais draw the square dot, X3D alwais draw the cross sign.
>

Hi Valeri,
Yes, nearly right.
With X3D, the algorithm is the following
- one line segment is npoints > 10000
- two line segments + if npoints > 3000
- three line segments otherwise * (3d star)

> - the marker size on the OpenGL correlate to the declared one,
> on X3D - not at all
>

correct

> So the only solution that I found to have some consistency on all 3
> displays (usual canvas, OpenGL and X3D) is to use TMarker3DBox.
> Are there any different approach?
>
Right. TMarker3DBox should be the best solution. You will find an
example
using TMarker3DBox below.
I would like to see what I consider an important improvement for this
class:
possibility to have shaded faces also on the normal Root pad. This is
important
for event displays. If somebody volunteers for this task, this would be
great!

> Conserned TMarker3DBox - why this object is not "rotateable" - it do not
> propose the "rotation" prompt on the usual view?
>

TMarker3DBox is "rotatable". You can try with the macro below.

> In general it seems that both X3D and OpenGL interfaces are fare from the
> good shape (colors on the X3D, perspective view on OpenGL etc.).
>

We have now problems with X3D with displays having more than 8 color
planes.
This is typical on PCs. If you downgrade your PC to use 8 colors only,
you will get the colors and the stereo view.

> Are there any plans to improve it?

Not in the short term. Again any volunteer?

Rene Brun

{
gROOT->Reset();
TH3F *h3 = new TH3F("h3","test fitz",5,-4,4,8,-4,4,5,0,20);
for (Int_t i=0;i<100000;i++) {
Float_t x = gRandom->Gaus(0,1);
Float_t y = gRandom->Gaus(0,1);
Float_t z = gRandom->Gaus(10,4);
h3->Fill(x,y,z);
}

Int_t bin,ix,iy,iz;
Float_t xmin,xmax,ymin,ymax,zmin,zmax,wmin,wmax,w;
Int_t nbinsx = h3->GetXaxis()->GetNbins();
Int_t nbinsy = h3->GetYaxis()->GetNbins();
Int_t nbinsz = h3->GetZaxis()->GetNbins();

//compute min and max of all cells
wmin = wmax = 0;
for (ix=1;ix<=nbinsx;ix++) {
for (iy=1;iy<=nbinsy;iy++) {
for (iz=1;iz<=nbinsz;iz++) {
bin = h3->GetBin(ix,iy,iz);
w = h3->GetBinContent(bin);
if (w > wmax) wmax = w;
if (w < wmin) wmin = w;
}
}
}
TCanvas *c1 = new TCanvas("c1");
TView *view = new TView(1);
view->SetRange(h3->GetXaxis()->GetXmin(),
h3->GetYaxis()->GetXmin(),
h3->GetZaxis()->GetXmin(),
h3->GetXaxis()->GetXmax(),
h3->GetYaxis()->GetXmax(),
h3->GetZaxis()->GetXmax());

//Draw TMarker3DBox with size proportional to cell content
TMarker3DBox *m3;
Float_t scale;
for (ix=1;ix<=nbinsx;ix++) {
xmin = h3->GetXaxis()->GetBinLowEdge(ix);
xmax = xmin + h3->GetXaxis()->GetBinWidth(ix);
for (iy=1;iy<=nbinsy;iy++) {
ymin = h3->GetYaxis()->GetBinLowEdge(iy);
ymax = ymin + h3->GetYaxis()->GetBinWidth(iy);
for (iz=1;iz<=nbinsz;iz++) {
zmin = h3->GetZaxis()->GetBinLowEdge(iz);
zmax = zmin + h3->GetZaxis()->GetBinWidth(iz);
bin = h3->GetBin(ix,iy,iz);
w = h3->GetBinContent(bin);
scale = (w-wmin)/(wmax-wmin);
m3 = new
TMarker3DBox(0.5*(xmin+xmax),0.5*(ymin+ymax),0.5*(zmin+zmax),

scale*(xmax-xmin),scale*(ymax-ymin),scale*(zmax-zmin),0,0);
m3->SetLineColor(h3->GetMarkerColor());
m3->Draw();
}
}
}

}