Logo ROOT  
Reference Guide
REveGeoPolyShape.hxx
Go to the documentation of this file.
1 // @(#)root/eve7:$Id$
2 // Author: Matevz Tadel 2007, 2018
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2019, 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 ROOT7_REveGeoPolyShape
13 #define ROOT7_REveGeoPolyShape
14 
15 #include "TGeoBBox.h"
16 
17 #include <vector>
18 
19 class TBuffer3D;
20 class TGeoCompositeShape;
21 class TGeoShape;
22 
23 namespace ROOT {
24 namespace Experimental {
25 
26 class REveRenderData;
27 
28 class REveGeoPolyShape : public TGeoBBox
29 {
30 private:
33 
34 protected:
35  std::vector<Double_t> fVertices;
36  std::vector<Double_t> fNormals;
37  std::vector<UInt_t> fPolyDesc;
39 
40  virtual void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const;
41 
42  void SetFromBuff3D(const TBuffer3D &buffer);
43 
44  Int_t CheckPoints(const UInt_t *source, UInt_t *dest) const;
45 
46  static Bool_t Eq(const Double_t *p1, const Double_t *p2);
47 
48  struct Edge_t
49  {
52  {
53  if (i <= j) { fI = i; fJ = j; }
54  else { fI = j; fJ = i; }
55  }
56 
57  bool operator<(const Edge_t& e) const
58  {
59  if (fI == e.fI) return fJ < e.fJ;
60  else return fI < e.fI;
61  }
62  };
63 
66 
67 public:
68  REveGeoPolyShape() = default;
69 
70  virtual ~REveGeoPolyShape() = default;
71 
72  Int_t GetNumFaces() const { return fNbPols; }
73 
75 
76  void BuildFromComposite(TGeoCompositeShape *cshp, Int_t n_seg = 60);
77  void BuildFromShape(TGeoShape *shape, Int_t n_seg = 60);
78 
79  void EnforceTriangles();
80  void CalculateNormals();
81 
82  virtual const TBuffer3D& GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
83  virtual TBuffer3D *MakeBuffer3D() const;
84 
85  static void SetAutoEnforceTriangles(Bool_t f);
87  static void SetAutoCalculateNormals(Bool_t f);
89 
90  ClassDef(REveGeoPolyShape, 1); // A shape with arbitrary tesselation for visualization of CSG shapes.
91 };
92 
93 }}
94 
95 #endif
ROOT::Experimental::REveGeoPolyShape::GetAutoEnforceTriangles
static Bool_t GetAutoEnforceTriangles()
Definition: REveGeoPolyShape.cxx:41
e
#define e(i)
Definition: RSha256.hxx:103
f
#define f(i)
Definition: RSha256.hxx:104
dest
#define dest(otri, vertexptr)
Definition: triangle.c:1040
ROOT::Experimental::REveGeoPolyShape::fPolyDesc
std::vector< UInt_t > fPolyDesc
Definition: REveGeoPolyShape.hxx:37
ROOT::Experimental::REveGeoPolyShape::EnforceTriangles
void EnforceTriangles()
Use GLU tesselator to replace all polygons with N > 3 with triangles.
Definition: REveGeoPolyShape.cxx:264
ROOT::Experimental::REveGeoPolyShape::GetAutoCalculateNormals
static Bool_t GetAutoCalculateNormals()
Definition: REveGeoPolyShape.cxx:43
ROOT::Experimental::REveGeoPolyShape::GetBuffer3D
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fill static buffer 3D.
Definition: REveGeoPolyShape.cxx:427
ROOT::Experimental::REveGeoPolyShape::operator=
REveGeoPolyShape & operator=(const REveGeoPolyShape &)=delete
ROOT::Experimental::REveRenderData
Definition: REveRenderData.hxx:24
Int_t
int Int_t
Definition: RtypesCore.h:45
ROOT::Experimental::REveGeoPolyShape::MakeBuffer3D
virtual TBuffer3D * MakeBuffer3D() const
Create buffer 3D and fill it with point/segment/poly data.
Definition: REveGeoPolyShape.cxx:439
ROOT::Experimental::REveGeoPolyShape::~REveGeoPolyShape
virtual ~REveGeoPolyShape()=default
TGeoBBox.h
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
bool
ROOT::Experimental::REveGeoPolyShape::Edge_t
Definition: REveGeoPolyShape.hxx:49
TGeoCompositeShape
Class handling Boolean composition of shapes.
Definition: TGeoCompositeShape.h:28
ROOT::Experimental::REveGeoPolyShape::Edge_t::fI
Int_t fI
Definition: REveGeoPolyShape.hxx:50
ROOT::Experimental::REveGeoPolyShape::Edge_t::Edge_t
Edge_t(Int_t i, Int_t j)
Definition: REveGeoPolyShape.hxx:51
ROOT::Experimental::REveGeoPolyShape::BuildFromComposite
void BuildFromComposite(TGeoCompositeShape *cshp, Int_t n_seg=60)
Produce all polygons from composite shape.
Definition: REveGeoPolyShape.cxx:92
ROOT::Experimental::REveGeoPolyShape::REveGeoPolyShape
REveGeoPolyShape(const REveGeoPolyShape &)=delete
ROOT::Experimental::REveGeoPolyShape::fVertices
std::vector< Double_t > fVertices
Definition: REveGeoPolyShape.hxx:35
TBuffer3D
Generic 3D primitive description class.
Definition: TBuffer3D.h:18
ROOT::Experimental::REveGeoPolyShape::CalculateNormals
void CalculateNormals()
CalculateNormals per polygon (flat shading)
Definition: REveGeoPolyShape.cxx:277
TGeoShape
Base abstract class for all shapes.
Definition: TGeoShape.h:26
ROOT::Experimental::REveGeoPolyShape::REveGeoPolyShape
REveGeoPolyShape()=default
ROOT::Experimental::REveGeoPolyShape::SetAutoEnforceTriangles
static void SetAutoEnforceTriangles(Bool_t f)
Definition: REveGeoPolyShape.cxx:40
ROOT::Experimental::REveGeoPolyShape::BuildFromShape
void BuildFromShape(TGeoShape *shape, Int_t n_seg=60)
Produce all polygons from normal shape.
Definition: REveGeoPolyShape.cxx:137
ROOT::Experimental::REveGeoPolyShape::fgAutoEnforceTriangles
static Bool_t fgAutoEnforceTriangles
Definition: REveGeoPolyShape.hxx:64
TGeoBBox
Box class.
Definition: TGeoBBox.h:18
ROOT::Experimental::REveGeoPolyShape::FillBuffer3D
virtual void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const
Fill the passed buffer 3D.
Definition: REveGeoPolyShape.cxx:358
unsigned int
ROOT::Experimental::REveGeoPolyShape::SetFromBuff3D
void SetFromBuff3D(const TBuffer3D &buffer)
Set data-members from a Csg mesh.
Definition: REveGeoPolyShape.cxx:187
ROOT::Experimental::REveGeoPolyShape::FillRenderData
void FillRenderData(REveRenderData &rd)
Definition: REveGeoPolyShape.cxx:159
ROOT::Experimental::REveGeoPolyShape::Eq
static Bool_t Eq(const Double_t *p1, const Double_t *p2)
Test equality of points with epsilon 1e-10.
Definition: REveGeoPolyShape.cxx:347
Double_t
double Double_t
Definition: RtypesCore.h:59
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
ROOT::Experimental::REveGeoPolyShape::fNormals
std::vector< Double_t > fNormals
Definition: REveGeoPolyShape.hxx:36
ROOT::Experimental::REveGeoPolyShape::Edge_t::fJ
Int_t fJ
Definition: REveGeoPolyShape.hxx:50
ROOT::Experimental::REveGeoPolyShape::fgAutoCalculateNormals
static Bool_t fgAutoCalculateNormals
Definition: REveGeoPolyShape.hxx:65
ROOT::Experimental::REveGeoPolyShape::CheckPoints
Int_t CheckPoints(const UInt_t *source, UInt_t *dest) const
CheckPoints.
Definition: REveGeoPolyShape.cxx:314
ROOT::Experimental::REveGeoPolyShape::SetAutoCalculateNormals
static void SetAutoCalculateNormals(Bool_t f)
Definition: REveGeoPolyShape.cxx:42
ROOT::Experimental::REveGeoPolyShape::GetNumFaces
Int_t GetNumFaces() const
Definition: REveGeoPolyShape.hxx:72
ROOT::Experimental::REveGeoPolyShape::Edge_t::operator<
bool operator<(const Edge_t &e) const
Definition: REveGeoPolyShape.hxx:57
ROOT
VSD Structures.
Definition: StringConv.hxx:21
ROOT::Experimental::REveGeoPolyShape
Definition: REveGeoPolyShape.hxx:29
ROOT::Experimental::REveGeoPolyShape::fNbPols
Int_t fNbPols
Definition: REveGeoPolyShape.hxx:38
int