box.C: Demonstrates usage of TEveBox class. | Event Display | boxset_cones.C: Demonstrates usage of 'cone' mode in TEveBoxSet class. |
// @(#)root/eve:$Id$ // Author: Matevz Tadel // Demonstrates usage of TEveBoxSet class. TEveBoxSet* boxset(Float_t x=0, Float_t y=0, Float_t z=0, Int_t num=100, Bool_t register=kTRUE) { TEveManager::Create(); TRandom r(0); gStyle->SetPalette(1, 0); TEveRGBAPalette* pal = new TEveRGBAPalette(0, 130); TEveFrameBox* frm = new TEveFrameBox(); frm->SetAABoxCenterHalfSize(0, 0, 0, 12, 12, 12); frm->SetFrameColor(kCyan); frm->SetBackColorRGBA(120,120,120,20); frm->SetDrawBack(kTRUE); TEveBoxSet* q = new TEveBoxSet("BoxSet"); q->SetPalette(pal); q->SetFrame(frm); q->Reset(TEveBoxSet::kBT_AABox, kFALSE, 64); for (Int_t i=0; i<num; ++i) { q->AddBox(r.Uniform(-10, 10), r.Uniform(-10, 10), r.Uniform(-10, 10), r.Uniform(0.2, 1), r.Uniform(0.2, 1), r.Uniform(0.2, 1)); q->DigitValue(r.Uniform(0, 130)); } q->RefitPlex(); TEveTrans& t = q->RefMainTrans(); t.SetPos(x, y, z); // Uncomment these two lines to get internal highlight / selection. // q->SetPickable(1); // q->SetAlwaysSecSelect(1); if (register) { gEve->AddElement(q); gEve->Redraw3D(kTRUE); } return q; } TEveBoxSet* boxset_colisval(Float_t x=0, Float_t y=0, Float_t z=0, Int_t num=100, Bool_t register=kTRUE) { TEveManager::Create(); TRandom r(0); TEveBoxSet* q = new TEveBoxSet("BoxSet"); q->Reset(TEveBoxSet::kBT_AABox, kTRUE, 64); for (Int_t i=0; i<num; ++i) { q->AddBox(r.Uniform(-10, 10), r.Uniform(-10, 10), r.Uniform(-10, 10), r.Uniform(0.2, 1), r.Uniform(0.2, 1), r.Uniform(0.2, 1)); q->DigitColor(r.Uniform(20, 255), r.Uniform(20, 255), r.Uniform(20, 255), r.Uniform(20, 255)); } q->RefitPlex(); TEveTrans& t = q->RefMainTrans(); t.SetPos(x, y, z); if (register) { gEve->AddElement(q); gEve->Redraw3D(kTRUE); } return q; } TEveBoxSet* boxset_single_color(Float_t x=0, Float_t y=0, Float_t z=0, Int_t num=100, Bool_t register=kTRUE) { TEveManager::Create(); TRandom r(0); TEveBoxSet* q = new TEveBoxSet("BoxSet"); q->UseSingleColor(); q->SetMainColor(kCyan-2); q->SetMainTransparency(50); q->Reset(TEveBoxSet::kBT_AABox, kFALSE, 64); for (Int_t i=0; i<num; ++i) { q->AddBox(r.Uniform(-10, 10), r.Uniform(-10, 10), r.Uniform(-10, 10), r.Uniform(0.2, 1), r.Uniform(0.2, 1), r.Uniform(0.2, 1)); } q->RefitPlex(); TEveTrans& t = q->RefMainTrans(); t.SetPos(x, y, z); if (register) { gEve->AddElement(q); gEve->Redraw3D(kTRUE); } return q; } TEveBoxSet* boxset_freebox(Int_t num=100, Bool_t register=kTRUE) { TEveManager::Create(); TRandom r(0); gStyle->SetPalette(1, 0); TEveRGBAPalette* pal = new TEveRGBAPalette(0, 130); TEveBoxSet* q = new TEveBoxSet("BoxSet"); q->SetPalette(pal); q->Reset(TEveBoxSet::kBT_FreeBox, kFALSE, 64); #define RND_BOX(x) r.Uniform(-(x), (x)) Float_t verts[24]; for (Int_t i=0; i<num; ++i) { Float_t x = RND_BOX(10); Float_t y = RND_BOX(10); Float_t z = RND_BOX(10); Float_t a = r.Uniform(0.2, 0.5); Float_t d = 0.05; Float_t verts[24] = { x - a + RND_BOX(d), y - a + RND_BOX(d), z - a + RND_BOX(d), x - a + RND_BOX(d), y + a + RND_BOX(d), z - a + RND_BOX(d), x + a + RND_BOX(d), y + a + RND_BOX(d), z - a + RND_BOX(d), x + a + RND_BOX(d), y - a + RND_BOX(d), z - a + RND_BOX(d), x - a + RND_BOX(d), y - a + RND_BOX(d), z + a + RND_BOX(d), x - a + RND_BOX(d), y + a + RND_BOX(d), z + a + RND_BOX(d), x + a + RND_BOX(d), y + a + RND_BOX(d), z + a + RND_BOX(d), x + a + RND_BOX(d), y - a + RND_BOX(d), z + a + RND_BOX(d) }; q->AddBox(verts); q->DigitValue(r.Uniform(0, 130)); } q->RefitPlex(); #undef RND_BOX // Uncomment these two lines to get internal highlight / selection. // q->SetPickable(1); // q->SetAlwaysSecSelect(1); if (register) { gEve->AddElement(q); gEve->Redraw3D(kTRUE); } return q; } boxset.C:1 boxset.C:2 boxset.C:3 boxset.C:4 boxset.C:5 boxset.C:6 boxset.C:7 boxset.C:8 boxset.C:9 boxset.C:10 boxset.C:11 boxset.C:12 boxset.C:13 boxset.C:14 boxset.C:15 boxset.C:16 boxset.C:17 boxset.C:18 boxset.C:19 boxset.C:20 boxset.C:21 boxset.C:22 boxset.C:23 boxset.C:24 boxset.C:25 boxset.C:26 boxset.C:27 boxset.C:28 boxset.C:29 boxset.C:30 boxset.C:31 boxset.C:32 boxset.C:33 boxset.C:34 boxset.C:35 boxset.C:36 boxset.C:37 boxset.C:38 boxset.C:39 boxset.C:40 boxset.C:41 boxset.C:42 boxset.C:43 boxset.C:44 boxset.C:45 boxset.C:46 boxset.C:47 boxset.C:48 boxset.C:49 boxset.C:50 boxset.C:51 boxset.C:52 boxset.C:53 boxset.C:54 boxset.C:55 boxset.C:56 boxset.C:57 boxset.C:58 boxset.C:59 boxset.C:60 boxset.C:61 boxset.C:62 boxset.C:63 boxset.C:64 boxset.C:65 boxset.C:66 boxset.C:67 boxset.C:68 boxset.C:69 boxset.C:70 boxset.C:71 boxset.C:72 boxset.C:73 boxset.C:74 boxset.C:75 boxset.C:76 boxset.C:77 boxset.C:78 boxset.C:79 boxset.C:80 boxset.C:81 boxset.C:82 boxset.C:83 boxset.C:84 boxset.C:85 boxset.C:86 boxset.C:87 boxset.C:88 boxset.C:89 boxset.C:90 boxset.C:91 boxset.C:92 boxset.C:93 boxset.C:94 boxset.C:95 boxset.C:96 boxset.C:97 boxset.C:98 boxset.C:99 boxset.C:100 boxset.C:101 boxset.C:102 boxset.C:103 boxset.C:104 boxset.C:105 boxset.C:106 boxset.C:107 boxset.C:108 boxset.C:109 boxset.C:110 boxset.C:111 boxset.C:112 boxset.C:113 boxset.C:114 boxset.C:115 boxset.C:116 boxset.C:117 boxset.C:118 boxset.C:119 boxset.C:120 boxset.C:121 boxset.C:122 boxset.C:123 boxset.C:124 boxset.C:125 boxset.C:126 boxset.C:127 boxset.C:128 boxset.C:129 boxset.C:130 boxset.C:131 boxset.C:132 boxset.C:133 boxset.C:134 boxset.C:135 boxset.C:136 boxset.C:137 boxset.C:138 boxset.C:139 boxset.C:140 boxset.C:141 boxset.C:142 boxset.C:143 boxset.C:144 boxset.C:145 boxset.C:146 boxset.C:147 boxset.C:148 boxset.C:149 boxset.C:150 boxset.C:151 boxset.C:152 boxset.C:153 boxset.C:154 boxset.C:155 boxset.C:156 boxset.C:157 boxset.C:158 |
|