Spherical 3D Surface Plots using OpenGL

Dear ROOTers,

I am experiencing problems when plotting a TH2D with the (otherwise very nice) options “glSurf1Sph”.

  1. The surface is not closed. The contents of the first and the last x-bin (i.e., phi=-180° and phi=+180°) are not connected. Is there an option to enable this, or am I doing something wrong? (If not, a new option “bool TStyle::CloseSphericalSurfacePlot” or so might be the solution…)

  2. If the plot is viewed with the GL Viewer, axes are drawn at the edges of the drawing box by default. How do I get rid of them?

  3. If I switch on axes in the GL Viewer (tab “Guides”) to be drawn at the origin , they show up in an unexpected way, definitely not centered in the origin. See the attached picture; the origin is in the middle of the doghnut-shape.

  4. If I choose axes to be drawn at the edge of the box, in addition to those described under (2), another set of axes is drawn which is tilted.

Any ideas / comments?

Thank you,

Moritz

PS: I am using ROOT 5.16/00 under Win32.







DrawGlSurfSph.C (548 Bytes)

Yes, it’s not closed. That’s because surface’s vertices are in bin centers, not low and upper edges. In principle, I can fix this, but there is no guarantee that you’ll have closed surface - your case is specific, but in more general cases boundary bins can differ seriously.
I’ll do small fix in 20-30 mins and show you picture to check, if it’s what you want.

About closed surface: I guess, you want something like this:


Hi Moritz,

I guess Timur will reply about 1) … he is doing the GL plot-painter stuff.

The other three fall into my domain. First a warning: Plotting of the histograms in the standard GL viewer is still in the experimental phase.

Ad.2) If you’re compiling from source then simply comment out the axis drawing code from gl/src/TH2GL.cxx in DirectDraw() function. Otherwise, I’m afraid, there’s not much one can do at the moment :frowning:

Ad.3,4) The histogram object is placed into the global space by following the object’s positioning in the pad (this helps if you draw a canvas with 4 sub-pads each showing a different 3d-plot). Further, the plot is scaled to obey the device-independent coordinates of the pad and rotated to match the viewing angle specified in the pad. If you shift-click on the object you can then modify its position, scale and rotation (see Help from the top-right side of the gl-window).

Some scaling is already done by Timur while building the plot object.

The axes under “Guides” tab show the global coordinate frame of the viewer which is not the same as the coordinate system of the histogram (shown by the axes you can’t get rid of).

Best,
Matevz

Hi Timur and Matevz,

thank you for your quick replies!

Timur, what you made is exactly what I was searching for. How do I get this into my code? (Up to now I was using the pre-compiled versions of Root but I am feeling something else coming…)

Matevz, the axis-in-glViewer-issues are not too urgent for me but I’d be glad if you could attach them to the list of todo’s.

Thanks again,

Moritz

This require recompilation. So if you cannot install ROOT from the sources, my fix is useless (though it can be commited in CVS/SVN)

Well, if you send me the patch, I can try my luck with recompiling ROOT…

[quote]Well, if you send me the patch, I can try my luck with recompiling ROOT…
[/quote]
Well, it’s already in SVN.

Timur, your patch made it into the new development release. This saved me from compiling root on my own. Thanks to everyone!

Moritz