Revision e46344e49680c060a7421a4328d27350cf14d35a authored by Joerg Stelzer on 27 June 2011, 16:10:06 UTC, committed by Joerg Stelzer on 27 June 2011, 16:10:06 UTC

git-svn-id: http://root.cern.ch/svn/root/branches/v5-30-00-patches@40014 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent 5eae153
Raw File
lineset.C
// @(#)root/eve:$Id$
// Author: Matevz Tadel

// Demonstrates usage of class TEveStraightLineSet.

TEveStraightLineSet* lineset(Int_t nlines = 40, Int_t nmarkers = 4) 
{
   TEveManager::Create();

   TRandom r(0);
   Float_t s = 100;

   TEveStraightLineSet* ls = new TEveStraightLineSet();

   for(Int_t i = 0; i<nlines; i++)
   {
      ls->AddLine( r.Uniform(-s,s), r.Uniform(-s,s), r.Uniform(-s,s),
                   r.Uniform(-s,s), r.Uniform(-s,s), r.Uniform(-s,s));
      // add random number of markers
      Int_t nm = Int_t(nmarkers* r.Rndm());
      for(Int_t m = 0; m < nm; m++) {
         ls->AddMarker(i, r.Rndm());
      }
   }

   ls->SetMarkerSize(1.5);
   ls->SetMarkerStyle(4);

   gEve->AddElement(ls);
   gEve->Redraw3D();

   return ls;
}

TEveStraightLineSet* lineset_2d(Int_t nlines = 40, Int_t nmarkers = 4) 
{
   TEveManager::Create();

   TRandom r(0);
   Float_t s = 100;

   TEveStraightLineSet* ls = new TEveStraightLineSet();

   for(Int_t i = 0; i<nlines; i++)
   {
      ls->AddLine( r.Uniform(-s,s), r.Uniform(-s,s), 0,
                   r.Uniform(-s,s), r.Uniform(-s,s), 0);
      // add random number of markers
      Int_t nm = Int_t(nmarkers* r.Rndm());
      for(Int_t m = 0; m < nm; m++) {
         ls->AddMarker(i, r.Rndm());
      }
   }

   ls->SetMarkerSize(1.5);
   ls->SetMarkerStyle(4);

   gEve->AddElement(ls);
   gEve->Redraw3D();

   return ls;
}
back to top