Set camera angle of TGeo objects in ROOT notebooks

Hello,

I would like to display certain 3D visual outputs in my notebooks with specific camera angles. I’m putting my TGeo objects in a TCanvas. I tried to pass options (such as zoom30) to TCanvas::Draw(), but they seem to be ignored.

Is there a way to pass these types of options per output of my ROOT notebooks? Right-clicking on my output, I can choose to “Get Camera Position”, and it gives me something like Position (as url): &opt=roty170,rotz57,zoom60. It would be great if I can just pass these options to TCanvas::Draw() or something similar.

I also had a look at some premade notebooks (on SWAN), but I did not see any camera settings being set there for the 3D visualization.

Cheers,
Ahmad


ROOT Version: 6.18/04
Platform: Ubuntu 16.04
Compiler: Not Provided


Hi Ahmad,

Just provide such string “roty170,rotz57,zoom60” as draw options for TGeo object when add it to TCanvas

Long (but still incomplete) list of TGeo draw options is here:

Regards,
Sergey

Hi Sergey,

Thanks for your reply. I actually just add my TGeo object (top volume: gGeoManager->GetTopVolume()) to the canvas only once, and then I keep updating the top volume, without adding it again. Is there a way to edit the options at a later stage. Maybe something like:

canvas->GetListOfPrimitives()[0]->SetOptions("...");

Best,
Ahmad

Hi,

Your code will not work. Check docu for TList. Most simple solution:

canvas->GetListOfPrimitives()->Clear();
canvas->GetListOfPrimitives()->Add(obj, "all;zoom30");

Sergey

Thanks Sergey, that works.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.