lineset.C

Go to the documentation of this file.
00001 // @(#)root/eve:$Id: lineset.C 30469 2009-09-25 16:51:44Z matevz $
00002 // Author: Matevz Tadel
00003 
00004 // Demonstrates usage of class TEveStraightLineSet.
00005 
00006 TEveStraightLineSet* lineset(Int_t nlines = 40, Int_t nmarkers = 4) 
00007 {
00008    TEveManager::Create();
00009 
00010    TRandom r(0);
00011    Float_t s = 100;
00012 
00013    TEveStraightLineSet* ls = new TEveStraightLineSet();
00014 
00015    for(Int_t i = 0; i<nlines; i++)
00016    {
00017       ls->AddLine( r.Uniform(-s,s), r.Uniform(-s,s), r.Uniform(-s,s),
00018                    r.Uniform(-s,s), r.Uniform(-s,s), r.Uniform(-s,s));
00019       // add random number of markers
00020       Int_t nm = Int_t(nmarkers* r.Rndm());
00021       for(Int_t m = 0; m < nm; m++) {
00022          ls->AddMarker(i, r.Rndm());
00023       }
00024    }
00025 
00026    ls->SetMarkerSize(1.5);
00027    ls->SetMarkerStyle(4);
00028 
00029    gEve->AddElement(ls);
00030    gEve->Redraw3D();
00031 
00032    return ls;
00033 }
00034 
00035 TEveStraightLineSet* lineset_2d(Int_t nlines = 40, Int_t nmarkers = 4) 
00036 {
00037    TEveManager::Create();
00038 
00039    TRandom r(0);
00040    Float_t s = 100;
00041 
00042    TEveStraightLineSet* ls = new TEveStraightLineSet();
00043 
00044    for(Int_t i = 0; i<nlines; i++)
00045    {
00046       ls->AddLine( r.Uniform(-s,s), r.Uniform(-s,s), 0,
00047                    r.Uniform(-s,s), r.Uniform(-s,s), 0);
00048       // add random number of markers
00049       Int_t nm = Int_t(nmarkers* r.Rndm());
00050       for(Int_t m = 0; m < nm; m++) {
00051          ls->AddMarker(i, r.Rndm());
00052       }
00053    }
00054 
00055    ls->SetMarkerSize(1.5);
00056    ls->SetMarkerStyle(4);
00057 
00058    gEve->AddElement(ls);
00059    gEve->Redraw3D();
00060 
00061    return ls;
00062 }

Generated on Tue Jul 5 15:43:51 2011 for ROOT_528-00b_version by  doxygen 1.5.1