Logo ROOT   6.07/09
Reference Guide
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 
9 const Int_t Ns = 7;
10 
11 void add_blobs(TEveElement* p, Float_t rad, Float_t height, Float_t size,
12  Int_t level)
13 {
14  if (level <= 0) return;
15 
16  for (Int_t i = 0; i < Ns; ++i)
17  {
18  TEveGeoShape* x = new TEveGeoShape("SS");
19  x->SetShape(new TGeoSphere(0, size));
20  Double_t phi = TMath::TwoPi() * i / Ns;
21  x->RefMainTrans().SetPos(rad*TMath::Cos(phi),
22  rad*TMath::Sin(phi),
23  height);
26  p->AddElement(x);
27 
28  add_blobs(x, 0.8 * rad, 0.8 * height, 0.8 * size, level - 1);
29  }
30 }
31 
32 void hierarchical_scene()
33 {
35 
36  TColor::SetPalette(1, 0);
37  gRandom = new TRandom3(0);
38 
39  TEveScene *s = gEve->SpawnNewScene("Hierachical Scene", "OoogaDooga");
41 
43 
44  add_blobs(s, 6, 4, 0.5, 4);
45 
47 }
void SetHierarchical(Bool_t h)
Definition: TEveScene.h:54
Spherical shell class.
Definition: TGeoSphere.h:19
Random number generator class based on M.
Definition: TRandom3.h:29
Eve representation of TGLScene.
Definition: TEveScene.h:26
float Float_t
Definition: RtypesCore.h:53
static Int_t GetNumberOfColors()
Static function returning number of colors in the color palette.
Definition: TColor.cxx:1367
int Int_t
Definition: RtypesCore.h:41
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Definition: TEveManager.h:168
static void SetPalette(Int_t ncolors, Int_t *colors, Float_t alpha=1.)
Static function.
Definition: TColor.cxx:2316
static Int_t GetColorPalette(Int_t i)
Static function returning the color number i in current palette.
Definition: TColor.cxx:1355
Double_t x[n]
Definition: legend1.C:17
virtual UInt_t Integer(UInt_t imax)
Returns a random integer on [ 0, imax-1 ].
Definition: TRandom.cxx:320
void SetShape(TGeoShape *s)
Set TGeoShape shown by this object.
virtual void SetMainColor(Color_t color)
Set main color.
Definition: TEveShape.cxx:58
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
Double_t TwoPi()
Definition: TMath.h:45
TEveViewer * GetDefaultViewer() const
Returns the default viewer - the first one in the fViewers list.
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
virtual void AddElement(TEveElement *el)
Add el to the list of children.
R__EXTERN TRandom * gRandom
Definition: TRandom.h:66
Double_t Cos(Double_t)
Definition: TMath.h:424
void SetPos(Double_t x, Double_t y, Double_t z)
Set position (base-vec 4).
Definition: TEveTrans.cxx:507
double Double_t
Definition: RtypesCore.h:55
Wrapper for TGeoShape with absolute positioning and color attributes allowing display of extracted TG...
Definition: TEveGeoShape.h:23
Double_t Sin(Double_t)
Definition: TMath.h:421
virtual TEveTrans & RefMainTrans()
Return reference to main transformation.
TEveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
const Bool_t kTRUE
Definition: Rtypes.h:91
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition: TEveElement.h:33
virtual void AddScene(TEveScene *scene)
Add &#39;scene&#39; to the list of scenes.
Definition: TEveViewer.cxx:261