// @(#)root/eve:$Id$
// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TEveBoxSet
#define ROOT_TEveBoxSet

#include "TEveDigitSet.h"
#include "TEveVector.h"

class TGeoMatrix;
class TRandom;

class TEveBoxSet: public TEveDigitSet
{
   friend class TEveBoxSetGL;

   TEveBoxSet(const TEveBoxSet&);            // Not implemented
   TEveBoxSet& operator=(const TEveBoxSet&); // Not implemented

public:
   enum EBoxType_e {
      kBT_Undef,           // unknown-ignored
      kBT_FreeBox,         // arbitrary box: specify 8*(x,y,z) box corners
      kBT_AABox,           // axis-aligned box: specify (x,y,z) and (w, h, d)
      kBT_AABoxFixedDim,   // axis-aligned box w/ fixed dimensions: specify (x,y,z)
      kBT_Cone,
      kBT_EllipticCone
   };

   struct BFreeBox_t       : public DigitBase_t { Float_t fVertices[8][3]; };

   struct BOrigin_t        : public DigitBase_t { Float_t fA, fB, fC; };

   struct BAABox_t         : public BOrigin_t   { Float_t fW, fH, fD; };

   struct BAABoxFixedDim_t : public BOrigin_t   {};

   struct BCone_t          : public DigitBase_t { TEveVector fPos, fDir; Float_t fR; };

   struct BEllipticCone_t  : public BCone_t     { Float_t fR2, fAngle; };

protected:
   EBoxType_e        fBoxType;      // Type of rendered box.

   Float_t           fDefWidth;     // Breadth assigned to first coordinate  (A).
   Float_t           fDefHeight;    // Breadth assigned to second coordinate (B).
   Float_t           fDefDepth;     // Breadth assigned to third coordinate  (C).

   Int_t             fBoxSkip;      // Number of boxes to skip for each drawn box during scene rotation.

   Bool_t            fDrawConeCap;

   static Int_t SizeofAtom(EBoxType_e bt);

public:
   TEveBoxSet(const char* n="TEveBoxSet", const char* t="");
   virtual ~TEveBoxSet() {}

   void Reset(EBoxType_e boxType, Bool_t valIsCol, Int_t chunkSize);
   void Reset();

   void AddBox(const Float_t* verts);
   void AddBox(Float_t a, Float_t b, Float_t c, Float_t w, Float_t h, Float_t d);
   void AddBox(Float_t a, Float_t b, Float_t c);

   void AddCone(const TEveVector& pos, const TEveVector& dir, Float_t r);
   void AddEllipticCone(const TEveVector& pos, const TEveVector& dir, Float_t r, Float_t r2, Float_t angle=0);

   virtual void ComputeBBox();
   // virtual void Paint(Option_t* option = "");

   void Test(Int_t nboxes);

   Float_t GetDefWidth()  const { return fDefWidth;  }
   Float_t GetDefHeight() const { return fDefHeight; }
   Float_t GetDefDepth()  const { return fDefDepth;  }
   Bool_t  GetDrawConeCap() const { return fDrawConeCap;  }

   void SetDefWidth(Float_t v)  { fDefWidth  = v ; }
   void SetDefHeight(Float_t v) { fDefHeight = v ; }
   void SetDefDepth(Float_t v)  { fDefDepth  = v ; }
   void SetDrawConeCap(Bool_t x) { fDrawConeCap=x; StampObjProps(); }

   Int_t GetBoxSkip()   const { return fBoxSkip; }
   void  SetBoxSkip(Int_t bs) { fBoxSkip = bs; }

   ClassDef(TEveBoxSet, 0); // Collection of 3D primitives (fixed-size boxes, boxes of different sizes, or arbitrary sexto-epipeds); each primitive can be assigned a signal value and a TRef.
};

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