Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TEveBoxSet.h
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TEveBoxSet
13 #define ROOT_TEveBoxSet
14 
15 #include "TEveDigitSet.h"
16 #include "TEveVector.h"
17 
18 class TGeoMatrix;
19 class TRandom;
20 
21 class TEveBoxSet: public TEveDigitSet
22 {
23  friend class TEveBoxSetGL;
24 
25  TEveBoxSet(const TEveBoxSet&); // Not implemented
26  TEveBoxSet& operator=(const TEveBoxSet&); // Not implemented
27 
28 public:
29  enum EBoxType_e {
30  kBT_Undef, // unknown-ignored
31  kBT_FreeBox, // arbitrary box: specify 8*(x,y,z) box corners
32  kBT_AABox, // axis-aligned box: specify (x,y,z) and (w, h, d)
33  kBT_AABoxFixedDim, // axis-aligned box w/ fixed dimensions: specify (x,y,z)
34  kBT_Cone,
35  kBT_EllipticCone,
36  kBT_Hex
37  };
38 
39  struct BFreeBox_t : public DigitBase_t { Float_t fVertices[8][3]; };
40 
41  struct BOrigin_t : public DigitBase_t { Float_t fA, fB, fC; };
42 
43  struct BAABox_t : public BOrigin_t { Float_t fW, fH, fD; };
44 
45  struct BAABoxFixedDim_t : public BOrigin_t {};
46 
47  struct BCone_t : public DigitBase_t { TEveVector fPos, fDir; Float_t fR; };
48 
49  struct BEllipticCone_t : public BCone_t { Float_t fR2, fAngle; };
50 
51  struct BHex_t : public DigitBase_t { TEveVector fPos; Float_t fR, fAngle, fDepth; };
52 
53 protected:
54  EBoxType_e fBoxType; // Type of rendered box.
55 
56  Float_t fDefWidth; // Breadth assigned to first coordinate (A).
57  Float_t fDefHeight; // Breadth assigned to second coordinate (B).
58  Float_t fDefDepth; // Breadth assigned to third coordinate (C).
59 
60  Int_t fBoxSkip; // Number of boxes to skip for each drawn box during scene rotation.
61 
62  Bool_t fDrawConeCap;
63 
64  static Int_t SizeofAtom(EBoxType_e bt);
65 
66 public:
67  TEveBoxSet(const char* n="TEveBoxSet", const char* t="");
68  virtual ~TEveBoxSet() {}
69 
70  void Reset(EBoxType_e boxType, Bool_t valIsCol, Int_t chunkSize);
71  void Reset();
72 
73  void AddBox(const Float_t* verts);
74  void AddBox(Float_t a, Float_t b, Float_t c, Float_t w, Float_t h, Float_t d);
75  void AddBox(Float_t a, Float_t b, Float_t c);
76 
77  void AddCone(const TEveVector& pos, const TEveVector& dir, Float_t r);
78  void AddEllipticCone(const TEveVector& pos, const TEveVector& dir, Float_t r, Float_t r2, Float_t angle=0);
79 
80  void AddHex(const TEveVector& pos, Float_t r, Float_t angle, Float_t depth);
81 
82  virtual void ComputeBBox();
83  // virtual void Paint(Option_t* option = "");
84 
85  void Test(Int_t nboxes);
86 
87  Float_t GetDefWidth() const { return fDefWidth; }
88  Float_t GetDefHeight() const { return fDefHeight; }
89  Float_t GetDefDepth() const { return fDefDepth; }
90  Bool_t GetDrawConeCap() const { return fDrawConeCap; }
91 
92  void SetDefWidth(Float_t v) { fDefWidth = v ; }
93  void SetDefHeight(Float_t v) { fDefHeight = v ; }
94  void SetDefDepth(Float_t v) { fDefDepth = v ; }
95  void SetDrawConeCap(Bool_t x) { fDrawConeCap=x; StampObjProps(); }
96 
97  Int_t GetBoxSkip() const { return fBoxSkip; }
98  void SetBoxSkip(Int_t bs) { fBoxSkip = bs; }
99 
100  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.
101 };
102 
103 #endif