ROOT logo
// $Id: Amphitheatre.h 2363 2010-04-06 20:49:16Z matevz $

// Copyright (C) 1999-2008, Matevz Tadel. All rights reserved.
// This file is part of GLED, released under GNU General Public License version 2.
// For the licensing terms see $GLEDSYS/LICENSE or http://www.gnu.org/.

#ifndef Geom1_Amphitheatre_H
#define Geom1_Amphitheatre_H

#include <Glasses/ZNode.h>
#include <Stones/ZColor.h>
#include <Stones/TimeMakerClient.h>

#include <TRandom.h>

class Amphitheatre : public ZNode, public TimeMakerClient
{
  MAC_RNR_FRIENDS(Amphitheatre);

private:
  void _init();

protected:
  struct Chair
  {
    ZPoint   fPos;
    ZNode*   fNode;

    Chair() : fPos(), fNode(0) {}
    Chair(const ZPoint& p, ZNode* n=0) : fPos(p), fNode(n) {}

    bool freep() { return fNode == 0; }
  };
  typedef list<Chair>           lChair_t;
  typedef list<Chair>::iterator lChair_i;

  ZLink<ZList>		mNewGuests;  // X{GS} L{}
  lChair_t		mChairs;

  Int_t			mNumCh;      // X{GS} 7 ValOut(-join=>1)
  Int_t			mNumChFree;  // X{GS} 7 ValOut()

  Int_t			mStageSides; // X{GS} 7 Value(-range=>[0,100,1], -join=>1)
  Float_t		mStageRot;   // X{GS} 7 Value(-range=>[-1,1,1,1000])
  Float_t		mStageSize;  // X{GS} 7 Value(-range=>[0,10,1,1000], -join=>1)
  Float_t		mChairSize;  // X{GS} 7 Value(-range=>[0,10,1,1000])

  Float_t		mGuestSize;  // X{GS} 7 Value(-range=>[0,10,1,1000], -join=>1)
  Float_t	     mGuestScaleFac; // X{GS} 7 Value(-range=>[0,1,1,1000])

  Float_t		mRepX0;        // X{GS} 7 Value(-range=>[0,10,1,1000], -join=>1)
  Float_t		mRepXm;        // X{GS} 7 Value(-range=>[0,10,1,1000], -join=>1)
  Float_t		mRepXM;        // X{GS} 7 Value(-range=>[0,10,1,1000])
  Float_t		mGuestStep;    // X{GS} 7 Value(-range=>[0,10,1,1000], -join=>1)
  UInt_t		mStepSleepMS;  // X{GS} 7 Value(-range=>[0,1e6,1])
  Bool_t		bChairHunt;    // X{GS} 7 BoolOut(-join=>1)
  Bool_t		bInnerHunt;    // X{GS} 7 Bool()

  Chair* closest_free_chair(const ZPoint& pos);

  void   chair_hunt(Double_t t, Double_t dt); // X{E}
  void   chair_hunt_emit_mir(Double_t t, Double_t dt);

  void   fix_guest_scale(ZNode* guest, bool finalp=false);

  //--------------------------------

  Bool_t		bRnrStage;  // X{gS}  7 Bool(-join=>1)
  Bool_t		bRnrChairs; // X{gS}  7 Bool()

  ZColor		mStageCol;  // X{gSP} 7 ColorButt(-join=>1)
  ZColor		mChairCol;  // X{gSP} 7 ColorButt()

  TRandom		mRnd;       //
  Double_t rnd(Double_t k=1, Double_t n=0);

public:
  Amphitheatre(const Text_t* n="Amphitheatre", const Text_t* t=0) :
    ZNode(n,t) { _init(); }

  virtual void AdEnlightenment();

  void CreateChairs(Float_t radius=4, Float_t xoffset=0, Float_t z=0,
		    Float_t dphi_deg=90, Int_t nchair=16); // X{E}
  void RemoveChairs();         // X{E} 7 MButt()

  void AddGuest(ZNode* guest); // X{E} C{1}
  void ClearFailedGuests();    // X{E} 7 MButt(-join=>1)
  void ClearAmphitheatre();    // X{E} 7 MButt()

  void StartHunt(); // X{E} 7 MButt(-join=>1)
  void StopHunt();  // X{E} 7 MButt()
  // TimeMakerClient
  virtual void TimeTick(Double_t t, Double_t dt);

  void MakeRandomGuests(Int_t nguests=10, Float_t box_size=10); // X{E} 7 MButt()

#include "Amphitheatre.h7"
  ClassDef(Amphitheatre, 1);
}; // endclass Amphitheatre


#endif
 Amphitheatre.h:1
 Amphitheatre.h:2
 Amphitheatre.h:3
 Amphitheatre.h:4
 Amphitheatre.h:5
 Amphitheatre.h:6
 Amphitheatre.h:7
 Amphitheatre.h:8
 Amphitheatre.h:9
 Amphitheatre.h:10
 Amphitheatre.h:11
 Amphitheatre.h:12
 Amphitheatre.h:13
 Amphitheatre.h:14
 Amphitheatre.h:15
 Amphitheatre.h:16
 Amphitheatre.h:17
 Amphitheatre.h:18
 Amphitheatre.h:19
 Amphitheatre.h:20
 Amphitheatre.h:21
 Amphitheatre.h:22
 Amphitheatre.h:23
 Amphitheatre.h:24
 Amphitheatre.h:25
 Amphitheatre.h:26
 Amphitheatre.h:27
 Amphitheatre.h:28
 Amphitheatre.h:29
 Amphitheatre.h:30
 Amphitheatre.h:31
 Amphitheatre.h:32
 Amphitheatre.h:33
 Amphitheatre.h:34
 Amphitheatre.h:35
 Amphitheatre.h:36
 Amphitheatre.h:37
 Amphitheatre.h:38
 Amphitheatre.h:39
 Amphitheatre.h:40
 Amphitheatre.h:41
 Amphitheatre.h:42
 Amphitheatre.h:43
 Amphitheatre.h:44
 Amphitheatre.h:45
 Amphitheatre.h:46
 Amphitheatre.h:47
 Amphitheatre.h:48
 Amphitheatre.h:49
 Amphitheatre.h:50
 Amphitheatre.h:51
 Amphitheatre.h:52
 Amphitheatre.h:53
 Amphitheatre.h:54
 Amphitheatre.h:55
 Amphitheatre.h:56
 Amphitheatre.h:57
 Amphitheatre.h:58
 Amphitheatre.h:59
 Amphitheatre.h:60
 Amphitheatre.h:61
 Amphitheatre.h:62
 Amphitheatre.h:63
 Amphitheatre.h:64
 Amphitheatre.h:65
 Amphitheatre.h:66
 Amphitheatre.h:67
 Amphitheatre.h:68
 Amphitheatre.h:69
 Amphitheatre.h:70
 Amphitheatre.h:71
 Amphitheatre.h:72
 Amphitheatre.h:73
 Amphitheatre.h:74
 Amphitheatre.h:75
 Amphitheatre.h:76
 Amphitheatre.h:77
 Amphitheatre.h:78
 Amphitheatre.h:79
 Amphitheatre.h:80
 Amphitheatre.h:81
 Amphitheatre.h:82
 Amphitheatre.h:83
 Amphitheatre.h:84
 Amphitheatre.h:85
 Amphitheatre.h:86
 Amphitheatre.h:87
 Amphitheatre.h:88
 Amphitheatre.h:89
 Amphitheatre.h:90
 Amphitheatre.h:91
 Amphitheatre.h:92
 Amphitheatre.h:93
 Amphitheatre.h:94
 Amphitheatre.h:95
 Amphitheatre.h:96
 Amphitheatre.h:97
 Amphitheatre.h:98
 Amphitheatre.h:99
 Amphitheatre.h:100
 Amphitheatre.h:101
 Amphitheatre.h:102
 Amphitheatre.h:103