Logo ROOT  
Reference Guide
box.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_eve
3/// Demonstrates usage of TEveBox class.
4///
5/// \image html eve_box.png
6/// \macro_code
7///
8/// \author Matevz Tadel
9#include <ROOT/REveBox.hxx>
10#include <ROOT/REveScene.hxx>
11#include <ROOT/REveManager.hxx>
12
13using namespace ROOT::Experimental;
14
16{
17 auto gEve = REveManager::Create();
18
19 TRandom& r = * gRandom;
20
21 auto b = new REveBox;
22 b->SetMainColor(kCyan);
23 b->SetMainTransparency(0);
24
25#define RND_BOX(x) r.Uniform(-(x), (x))
26 b->SetVertex(0, x - a + RND_BOX(d), y - a + RND_BOX(d), z - a + RND_BOX(d));
27 b->SetVertex(1, x - a + RND_BOX(d), y + a + RND_BOX(d), z - a + RND_BOX(d));
28 b->SetVertex(2, x + a + RND_BOX(d), y + a + RND_BOX(d), z - a + RND_BOX(d));
29 b->SetVertex(3, x + a + RND_BOX(d), y - a + RND_BOX(d), z - a + RND_BOX(d));
30 b->SetVertex(4, x - a + RND_BOX(d), y - a + RND_BOX(d), z + a + RND_BOX(d));
31 b->SetVertex(5, x - a + RND_BOX(d), y + a + RND_BOX(d), z + a + RND_BOX(d));
32 b->SetVertex(6, x + a + RND_BOX(d), y + a + RND_BOX(d), z + a + RND_BOX(d));
33 b->SetVertex(7, x + a + RND_BOX(d), y - a + RND_BOX(d), z + a + RND_BOX(d));
34#undef RND_BOX
35
37 gEve->Show();
38
39 return b;
40}
ROOT::R::TRInterface & r
Definition: Object.C:4
#define d(i)
Definition: RSha256.hxx:102
#define b(i)
Definition: RSha256.hxx:100
@ kCyan
Definition: Rtypes.h:64
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
R__EXTERN TRandom * gRandom
Definition: TRandom.h:62
virtual void AddElement(TEveElement *el)
Add el to the list of children.
TEveScene * GetEventScene() const
Definition: TEveManager.h:148
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:27
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
auto * a
Definition: textangle.C:12