From $ROOTSYS/tutorials/eve/compound.C

// @(#)root/eve:$Id$
// Author: Matevz Tadel

// Demonstates usage of EVE compound objects - class TEveCompound.

TEveLine* random_line(TRandom& rnd, Int_t n, Float_t delta)
{
   TEveLine* line = new TEveLine;
   line->SetMainColor(kGreen);

   Float_t x = 0, y = 0, z = 0;
   for (Int_t i=0; i<n; ++i)
   {
      line->SetNextPoint(x, y, z);
      x += rnd.Uniform(0, delta);
      y += rnd.Uniform(0, delta);
      z += rnd.Uniform(0, delta);
   }

   return line;
}

void compound()
{
   TEveManager::Create();

   TEveLine* ml = new TEveLine;
   ml->SetMainColor(kRed);
   ml->SetLineStyle(2);
   ml->SetLineWidth(3);
   gEve->InsertVizDBEntry("BigLine", ml);

   TEveCompound* cmp = new TEveCompound;
   cmp->SetMainColor(kGreen);
   gEve->AddElement(cmp);

   TRandom rnd(0);

   cmp->OpenCompound();

   cmp->AddElement(random_line(rnd, 20, 10));
   cmp->AddElement(random_line(rnd, 20, 10));

   TEveLine* line = random_line(rnd, 20, 12);
   line->ApplyVizTag("BigLine");
   cmp->AddElement(line);

   cmp->CloseCompound();

   // Projected view
   TEveViewer *viewer = gEve->SpawnNewViewer("Projected");
   TEveScene  *scene  = gEve->SpawnNewScene("Projected Event");
   viewer->AddScene(scene);
   {
      TGLViewer* v = viewer->GetGLViewer();
      v->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
   }

   // projections
   TEveProjectionManager* mng = new TEveProjectionManager(TEveProjection::kPT_RPhi);
   scene->AddElement(mng);
   TEveProjectionAxes* axes = new TEveProjectionAxes(mng);
   scene->AddElement(axes);
   gEve->AddToListTree(axes, kTRUE);
   gEve->AddToListTree(mng, kTRUE);

   mng->ImportElements(cmp);

   gEve->Redraw3D(kTRUE);
}
 compound.C:1
 compound.C:2
 compound.C:3
 compound.C:4
 compound.C:5
 compound.C:6
 compound.C:7
 compound.C:8
 compound.C:9
 compound.C:10
 compound.C:11
 compound.C:12
 compound.C:13
 compound.C:14
 compound.C:15
 compound.C:16
 compound.C:17
 compound.C:18
 compound.C:19
 compound.C:20
 compound.C:21
 compound.C:22
 compound.C:23
 compound.C:24
 compound.C:25
 compound.C:26
 compound.C:27
 compound.C:28
 compound.C:29
 compound.C:30
 compound.C:31
 compound.C:32
 compound.C:33
 compound.C:34
 compound.C:35
 compound.C:36
 compound.C:37
 compound.C:38
 compound.C:39
 compound.C:40
 compound.C:41
 compound.C:42
 compound.C:43
 compound.C:44
 compound.C:45
 compound.C:46
 compound.C:47
 compound.C:48
 compound.C:49
 compound.C:50
 compound.C:51
 compound.C:52
 compound.C:53
 compound.C:54
 compound.C:55
 compound.C:56
 compound.C:57
 compound.C:58
 compound.C:59
 compound.C:60
 compound.C:61
 compound.C:62
 compound.C:63
 compound.C:64
 compound.C:65
 compound.C:66
 compound.C:67
 compound.C:68
 compound.C:69
 compound.C:70
 compound.C:71