Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:40

0001 // @(#)root/eve:$Id$
0002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TEveBoxSet
0013 #define ROOT_TEveBoxSet
0014 
0015 #include "TEveDigitSet.h"
0016 #include "TEveVector.h"
0017 
0018 class TGeoMatrix;
0019 class TRandom;
0020 
0021 class TEveBoxSet: public TEveDigitSet
0022 {
0023    friend class TEveBoxSetGL;
0024 
0025    TEveBoxSet(const TEveBoxSet&);            // Not implemented
0026    TEveBoxSet& operator=(const TEveBoxSet&); // Not implemented
0027 
0028 public:
0029    enum EBoxType_e {
0030       kBT_Undef,           // unknown-ignored
0031       kBT_FreeBox,         // arbitrary box: specify 8*(x,y,z) box corners
0032       kBT_AABox,           // axis-aligned box: specify (x,y,z) and (w, h, d)
0033       kBT_AABoxFixedDim,   // axis-aligned box w/ fixed dimensions: specify (x,y,z)
0034       kBT_Cone,
0035       kBT_EllipticCone,
0036       kBT_Hex
0037    };
0038 
0039    struct BFreeBox_t       : public DigitBase_t { Float_t fVertices[8][3]; };
0040 
0041    struct BOrigin_t        : public DigitBase_t { Float_t fA, fB, fC; };
0042 
0043    struct BAABox_t         : public BOrigin_t   { Float_t fW, fH, fD; };
0044 
0045    struct BAABoxFixedDim_t : public BOrigin_t   {};
0046 
0047    struct BCone_t          : public DigitBase_t { TEveVector fPos, fDir; Float_t fR; };
0048 
0049    struct BEllipticCone_t  : public BCone_t     { Float_t fR2, fAngle; };
0050 
0051    struct BHex_t           : public DigitBase_t { TEveVector fPos; Float_t fR, fAngle, fDepth; };
0052 
0053 protected:
0054    EBoxType_e        fBoxType;      // Type of rendered box.
0055 
0056    Float_t           fDefWidth;     // Breadth assigned to first coordinate  (A).
0057    Float_t           fDefHeight;    // Breadth assigned to second coordinate (B).
0058    Float_t           fDefDepth;     // Breadth assigned to third coordinate  (C).
0059 
0060    Int_t             fBoxSkip;      // Number of boxes to skip for each drawn box during scene rotation.
0061 
0062    Bool_t            fDrawConeCap;
0063 
0064    static Int_t SizeofAtom(EBoxType_e bt);
0065 
0066 public:
0067    TEveBoxSet(const char* n="TEveBoxSet", const char* t="");
0068    ~TEveBoxSet() override {}
0069 
0070    void Reset(EBoxType_e boxType, Bool_t valIsCol, Int_t chunkSize);
0071    void Reset();
0072 
0073    void AddBox(const Float_t* verts);
0074    void AddBox(Float_t a, Float_t b, Float_t c, Float_t w, Float_t h, Float_t d);
0075    void AddBox(Float_t a, Float_t b, Float_t c);
0076 
0077    void AddCone(const TEveVector& pos, const TEveVector& dir, Float_t r);
0078    void AddEllipticCone(const TEveVector& pos, const TEveVector& dir, Float_t r, Float_t r2, Float_t angle=0);
0079 
0080    void AddHex(const TEveVector& pos, Float_t r, Float_t angle, Float_t depth);
0081 
0082    void ComputeBBox() override;
0083    // virtual void Paint(Option_t* option = "");
0084 
0085    void Test(Int_t nboxes);
0086 
0087    Float_t GetDefWidth()  const { return fDefWidth;  }
0088    Float_t GetDefHeight() const { return fDefHeight; }
0089    Float_t GetDefDepth()  const { return fDefDepth;  }
0090    Bool_t  GetDrawConeCap() const { return fDrawConeCap;  }
0091 
0092    void SetDefWidth(Float_t v)  { fDefWidth  = v ; }
0093    void SetDefHeight(Float_t v) { fDefHeight = v ; }
0094    void SetDefDepth(Float_t v)  { fDefDepth  = v ; }
0095    void SetDrawConeCap(Bool_t x) { fDrawConeCap=x; StampObjProps(); }
0096 
0097    Int_t GetBoxSkip()   const { return fBoxSkip; }
0098    void  SetBoxSkip(Int_t bs) { fBoxSkip = bs; }
0099 
0100    ClassDefOverride(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.
0101 };
0102 
0103 #endif