Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
hierarchical_scene.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_eve
3///
4/// \image html eve_hierarchical_scene.png
5/// \macro_code
6///
7/// \author Matevz Tadel
8
9const Int_t Ns = 7;
10
11void add_blobs(TEveElement *p, Float_t rad, Float_t height, Float_t size, Int_t level)
12{
13 if (level <= 0)
14 return;
15
16 for (Int_t i = 0; i < Ns; ++i) {
17 auto x = new TEveGeoShape("SS");
18 x->SetShape(new TGeoSphere(0, size));
19 Double_t phi = TMath::TwoPi() * i / Ns;
20 x->RefMainTrans().SetPos(rad * TMath::Cos(phi), rad * TMath::Sin(phi), height);
22 p->AddElement(x);
23
24 add_blobs(x, 0.8 * rad, 0.8 * height, 0.8 * size, level - 1);
25 }
26}
27
28void hierarchical_scene()
29{
31
33 gRandom = new TRandom3(0);
34
35 auto s = gEve->SpawnNewScene("Hierarchical Scene", "OoogaDooga");
36 s->SetHierarchical(kTRUE);
37
38 gEve->GetDefaultViewer()->AddScene(s);
39
40 add_blobs(s, 6, 4, 0.5, 4);
41
42 gEve->Redraw3D(kTRUE);
43}
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
float Float_t
Float 4 bytes (float).
Definition RtypesCore.h:71
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
externTEveManager * gEve
externTRandom * gRandom
Definition TRandom.h:62
static void SetPalette(Int_t ncolors, Int_t *colors, Float_t alpha=1.)
static Int_t GetNumberOfColors()
static Int_t GetColorPalette(Int_t i)
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
virtual void AddElement(TEveElement *el)
Add el to the list of children.
Wrapper for TGeoShape with absolute positioning and color attributes allowing display of extracted TG...
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
Random number generator class based on M.
Definition TRandom3.h:27
Double_t x[n]
Definition legend1.C:17
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:605
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:599
constexpr Double_t TwoPi()
Definition TMath.h:47