How to zoom GLViewer?

Dear ROOT pros [-o<

I want to have a button which will zoom the point (0,0,0) in the TGLViewer as much as possible.
This point is the collision point in my application and I need to see it very closely. I have tried several methods, but none of them gave me the result I want.

Here is the full view and the zoomed view (which is maximal mouse scroll zoom)

Picture:
http://s11.postimg.org/i0utko3le/wopwop.jpg

Thank you very much for your help! [-o<

Hi,

Have you tried:
http://root.cern.ch/root/htmldoc/TGLPerspectiveCamera.html#TGLPerspectiveCamera:Configure
or, maybe even better (I actually never tried this myself but seems interesting :slight_smile: ):
http://root.cern.ch/root/htmldoc/TGLPerspectiveCamera.html#TGLPerspectiveCamera:Setup
? There are similar functions for TGLOrthoCamera (but it doesn’t have field-of-view / FOV parameter).

Now, if you really want to zoom deep into the vertex region, 3D view will turn out to be treacherous and also hard to control (are you aware the control and control-shift make all camera movements 10x, 100x more precise?).

The non-linear transforms of the projected views were developed just for this purpose. Try tutorials/eve/alice_vsd.C and then select “Eve” tab, select RhoPhi entry in object tree and then manipulate the “Distortion” value.

Cheers,
Matevz

I have tried zooming with function Configure.
This is how my code looks like:

Zoom(){ 
		gEve->GetDefaultGLViewer()->ResetCameras();
		Double_t center[3] = {0,0,0};
		TGLViewer *v = gEve->GetDefaultGLViewer();
		v->CurrentCamera().Reset();
		v->CurrentCamera().Configure(0.005, 0, center, 1.57, -1.57);
		v->DoDraw();
}

These are the results:

Picture:
http://s11.postimg.org/6ks72ymle/bla.jpg

But it is still not enough zoomed :smiley:
Is there something else I can do with function Configure?
I haven’t tried yet to zoom with Setup function.

Thank you! [-o<

If you use perspective camera, you can also try using the dolly parameter to move the whole camera closer to the center. I think, if you only use FOV, the camera will calculate distance so as to cover the whole window with all the scene. Do try Setup(), please :slight_smile:

You still didn’t tell us what you want to do … and the image didn’t get attached, either.

I have added links to posts with photos. Sorry because of that, on my computer posts looked fine. :blush:
I am now trying out Setup settings. It is not easy to find the right Bounding Box, but it might be ok. Why does it need all 8 points? Isn’t just 4 enough?

You can also use this constructor:
root.cern.ch/root/htmldoc/TGLBou … ndingBox@3

About finding the location of the box … it’s the same problem even if you call camera::configure … isn’t it?

What is your input that determines the region you should show? I somehow assumed you are trying too zoom into LHCb vertex region but I can’t remember why anymore :slight_smile:

A couple of posts back I asked you if you are only using 3d and are sure 3d is the most useful representation …

I have successfully modified zoom button by using first Setup() function and then Configure().

Thank you! =D>

Yes, I am using 3D view, and it is very hard to control when it’s zoomed.

I cannot run alice_vsd.C on windows, but i have searched for the words “Distortion” and “RhoPhi” in the code and I couldn’t find them. Where could I find the code for managing the non-linear transforms of the projected view? That might be even better solution. :smiley:

Good, I’m glad it works now :slight_smile:

There is a brief high-level description of projections here, section 5:
pos.sissa.it//archive/conference … 08_103.pdf

There is also a simple tutorials/eve/projection.C which you should be able to run without a compiler.
Otherwise, TEveProjectionManager, root.cern.ch/root/htmldoc/TEvePr … nager.html, and
TEveProjection, root.cern.ch/root/htmldoc/TEveProjection.html, are the core of the projection system.

alice_esd.C and alice_vsd.C are actually rather good examples. If I understand correctly, you don’t have a working compiler, right?

I have a working compiler. 8)
I am compiling with c++ compiler in visual studio 2012. But I cannot run alice_vsd.C because it was made for linux.

I would like to use the Distortion Horisontal Slider from projection.C in my GUI. Is it somehow possible?

Could you maybe give me a hint how is zooming in alice_vsd realised? I have searched for some key words, but I couldn’t find anything.

Hmmh … why do you say it was made for linux? I know Bertrand was running this on Windows when this was first implemented.

Abut the slider, just do what happens in the GUI class, TEveProjectionManagerEditor.cxx, member fDistortion.

First, have you managed to get the multi-view (as in tutroials/eve/MultiView.C) working, with r-phi and rho-z projections of your scene elements?