Logo ROOT   6.21/01
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:
31  REveGeoPolyShape(const REveGeoPolyShape&) = delete;
33 
34 protected:
35  std::vector<Double_t> fVertices;
36  std::vector<Double_t> fNormals;
37  std::vector<Int_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 Int_t *source, Int_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
void BuildFromShape(TGeoShape *shape, Int_t n_seg=60)
Produce all polygons from normal shape.
static void SetAutoCalculateNormals(Bool_t f)
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fill static buffer 3D.
Box class.
Definition: TGeoBBox.h:17
Returns the available number of logical cores.
Definition: StringConv.hxx:21
void EnforceTriangles()
Use GLU tesselator to replace all polygons with N > 3 with triangles.
#define f(i)
Definition: RSha256.hxx:104
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
REveGeoPolyShape & operator=(const REveGeoPolyShape &)=delete
#define ClassDef(name, id)
Definition: Rtypes.h:326
void FillRenderData(REveRenderData &rd)
Class handling Boolean composition of shapes.
Base abstract class for all shapes.
Definition: TGeoShape.h:25
virtual void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const
Fill the passed buffer 3D.
void SetFromBuff3D(const TBuffer3D &buffer)
Set data-members from a Csg mesh.
Generic 3D primitive description class.
Definition: TBuffer3D.h:17
void CalculateNormals()
CalculateNormals per polygon (flat shading)
void BuildFromComposite(TGeoCompositeShape *cshp, Int_t n_seg=60)
Produce all polygons from composite shape.
static Bool_t Eq(const Double_t *p1, const Double_t *p2)
Test equality of points with epsilon 1e-10.
double Double_t
Definition: RtypesCore.h:55
static void SetAutoEnforceTriangles(Bool_t f)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
#define dest(otri, vertexptr)
Definition: triangle.c:1040
virtual TBuffer3D * MakeBuffer3D() const
Create buffer 3D and fill it with point/segment/poly data.
Int_t CheckPoints(const Int_t *source, Int_t *dest) const
CheckPoints.