Logo ROOT   6.14/05
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 
11 {
13 
14  TRandom& r = * gRandom;
15 
16  TEveBox* b = new TEveBox;
17  b->SetMainColor(kCyan);
18  b->SetMainTransparency(0);
19 
20 #define RND_BOX(x) r.Uniform(-(x), (x))
21  b->SetVertex(0, x - a + RND_BOX(d), y - a + RND_BOX(d), z - a + RND_BOX(d));
22  b->SetVertex(1, x - a + RND_BOX(d), y + a + RND_BOX(d), z - a + RND_BOX(d));
23  b->SetVertex(2, x + a + RND_BOX(d), y + a + RND_BOX(d), z - a + RND_BOX(d));
24  b->SetVertex(3, x + a + RND_BOX(d), y - a + RND_BOX(d), z - a + RND_BOX(d));
25  b->SetVertex(4, x - a + RND_BOX(d), y - a + RND_BOX(d), z + a + RND_BOX(d));
26  b->SetVertex(5, x - a + RND_BOX(d), y + a + RND_BOX(d), z + a + RND_BOX(d));
27  b->SetVertex(6, x + a + RND_BOX(d), y + a + RND_BOX(d), z + a + RND_BOX(d));
28  b->SetVertex(7, x + a + RND_BOX(d), y - a + RND_BOX(d), z + a + RND_BOX(d));
29 #undef RND_BOX
30 
31  gEve->AddElement(b);
33 
34  return b;
35 }
void SetVertex(Int_t i, Float_t x, Float_t y, Float_t z)
Set vertex 'i'.
Definition: TEveBox.cxx:48
float Float_t
Definition: RtypesCore.h:53
3D box with arbitrary vertices (cuboid).
Definition: TEveBox.h:21
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Definition: TEveManager.h:168
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1
void AddElement(TEveElement *element, TEveElement *parent=0)
Add an element.
Double_t x[n]
Definition: legend1.C:17
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:27
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.
ROOT::R::TRInterface & r
Definition: Object.C:4
auto * a
Definition: textangle.C:12
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
R__EXTERN TRandom * gRandom
Definition: TRandom.h:62
virtual void SetMainTransparency(Char_t t)
Set main-transparency.
#define d(i)
Definition: RSha256.hxx:102
Double_t y[n]
Definition: legend1.C:17
Definition: Rtypes.h:59
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
const Bool_t kTRUE
Definition: RtypesCore.h:87