Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TEveGeoPolyShape.h
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Author: Matevz Tadel 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_TEveGeoPolyShape
13 #define ROOT_TEveGeoPolyShape
14 
15 #include "Rtypes.h"
16 #include "TGeoBBox.h"
17 
18 #include <vector>
19 
20 class TBuffer3D;
21 class TGLFaceSet;
22 class TGeoCompositeShape;
23 
24 class TEveGeoPolyShape : public TGeoBBox
25 {
26  friend class TEveGeoPolyShapeGL;
27 
28 private:
29  TEveGeoPolyShape(const TEveGeoPolyShape&); // Not implemented
30  TEveGeoPolyShape& operator=(const TEveGeoPolyShape&); // Not implemented
31 
32 protected:
33  std::vector<Double_t> fVertices;
34  std::vector<Int_t> fPolyDesc;
35  UInt_t fNbPols;
36 
37  virtual void FillBuffer3D(TBuffer3D& buffer, Int_t reqSections, Bool_t localFrame) const;
38 
39  struct Edge_t
40  {
41  Int_t fI, fJ;
42  Edge_t(Int_t i, Int_t j)
43  {
44  if (i <= j) { fI = i; fJ = j; }
45  else { fI = j; fJ = i; }
46  }
47 
48  bool operator<(const Edge_t& e) const
49  {
50  if (fI == e.fI)
51  return fJ < e.fJ;
52  else
53  return fI < e.fI;
54  }
55  };
56 
57 public:
58  TEveGeoPolyShape();
59  virtual ~TEveGeoPolyShape() {}
60 
61  static TEveGeoPolyShape* Construct(TGeoCompositeShape *cshp, Int_t n_seg);
62 
63  void SetFromFaceSet(TGLFaceSet* fs);
64 
65  virtual const TBuffer3D& GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
66  virtual TBuffer3D* MakeBuffer3D() const;
67 
68  ClassDef(TEveGeoPolyShape, 1); // A shape with arbitrary tesselation for visualization of CSG shapes.
69 };
70 
71 #endif