Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
compound.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_eve
3/// Demonstrates usage of EVE compound objects - class TEveCompound.
4///
5/// \image html eve_compound.png
6/// \macro_code
7///
8/// \author Matevz Tadel
9
11{
12 auto line = new TEveLine;
13 line->SetMainColor(kGreen);
14
15 Float_t x = 0, y = 0, z = 0;
16 for (Int_t i=0; i<n; ++i) {
17 line->SetNextPoint(x, y, z);
18 x += rnd.Uniform(0, delta);
19 y += rnd.Uniform(0, delta);
20 z += rnd.Uniform(0, delta);
21 }
22
23 return line;
24}
25
26void compound()
27{
29
30 auto ml = new TEveLine;
31 ml->SetMainColor(kRed);
32 ml->SetLineStyle(2);
33 ml->SetLineWidth(3);
34 gEve->InsertVizDBEntry("BigLine", ml);
35
36 auto cmp = new TEveCompound;
37 cmp->SetMainColor(kGreen);
38 gEve->AddElement(cmp);
39
40 TRandom rnd(0);
41
42 cmp->OpenCompound();
43
44 cmp->AddElement(random_line(rnd, 20, 10));
45 cmp->AddElement(random_line(rnd, 20, 10));
46
47 auto line = random_line(rnd, 20, 12);
48 line->ApplyVizTag("BigLine");
49 cmp->AddElement(line);
50
51 cmp->CloseCompound();
52
53 // Projected view
54 auto viewer = gEve->SpawnNewViewer("Projected");
55 auto scene = gEve->SpawnNewScene("Projected Event");
56 viewer->AddScene(scene);
57 {
58 auto v = viewer->GetGLViewer();
59 v->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
60 }
61
62 // projections
64 scene->AddElement(mng);
65 auto axes = new TEveProjectionAxes(mng);
66 scene->AddElement(axes);
67 gEve->AddToListTree(axes, kTRUE);
69
70 mng->ImportElements(cmp);
71
73}
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
const Bool_t kTRUE
Definition RtypesCore.h:100
@ kRed
Definition Rtypes.h:66
@ kGreen
Definition Rtypes.h:66
R__EXTERN TEveManager * gEve
Description of TEveCompound.
virtual void SetMainColor(Color_t color)
SetMainColor for the compound.
virtual void SetMainColor(Color_t color)
Set main color of the element.
An arbitrary polyline with fixed line and marker attributes.
Definition TEveLine.h:26
void AddElement(TEveElement *element, TEveElement *parent=0)
Add an element.
TGListTreeItem * AddToListTree(TEveElement *re, Bool_t open, TGListTree *lt=0)
Bool_t InsertVizDBEntry(const TString &tag, TEveElement *model, Bool_t replace, Bool_t update)
Insert a new visualization-parameter database entry.
TEveViewer * SpawnNewViewer(const char *name, const char *title="", Bool_t embed=kTRUE)
Create a new GL viewer.
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
TEveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
Axes for non-linear projections.
Manager class for steering of projections and managing projected objects.
@ kCameraOrthoXOY
Definition TGLViewer.h:62
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
Definition TRandom.cxx:672
TLine * line
void compound()
Definition compound.C:25
REX::REveLine * random_line(TRandom &rnd, Int_t n, Float_t delta)
Definition compound.C:9
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16