File indexing completed on 2025-01-18 10:10:39
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT7_REveGeoPolyShape
0013 #define ROOT7_REveGeoPolyShape
0014
0015 #include "TGeoBBox.h"
0016
0017 #include <vector>
0018
0019 class TBuffer3D;
0020 class TGeoCompositeShape;
0021 class TGeoShape;
0022
0023 namespace ROOT {
0024 namespace Experimental {
0025
0026 class REveRenderData;
0027
0028 class REveGeoPolyShape : public TGeoBBox
0029 {
0030 private:
0031 REveGeoPolyShape(const REveGeoPolyShape&) = delete;
0032 REveGeoPolyShape& operator=(const REveGeoPolyShape&) = delete;
0033
0034 protected:
0035 std::vector<Double_t> fVertices;
0036 std::vector<Double_t> fNormals;
0037 std::vector<UInt_t> fPolyDesc;
0038 Int_t fNbPols{0};
0039
0040 void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const override;
0041
0042 void SetFromBuff3D(const TBuffer3D &buffer);
0043
0044 Int_t CheckPoints(const UInt_t *source, UInt_t *dest) const;
0045
0046 static Bool_t Eq(const Double_t *p1, const Double_t *p2);
0047
0048 struct Edge_t
0049 {
0050 Int_t fI, fJ;
0051 Edge_t(Int_t i, Int_t j)
0052 {
0053 if (i <= j) { fI = i; fJ = j; }
0054 else { fI = j; fJ = i; }
0055 }
0056
0057 bool operator<(const Edge_t& e) const
0058 {
0059 if (fI == e.fI) return fJ < e.fJ;
0060 else return fI < e.fI;
0061 }
0062 };
0063
0064 static Bool_t fgAutoEnforceTriangles;
0065 static Bool_t fgAutoCalculateNormals;
0066
0067 public:
0068 REveGeoPolyShape() = default;
0069
0070 ~REveGeoPolyShape() override = default;
0071
0072 Int_t GetNumFaces() const { return fNbPols; }
0073
0074 void FillRenderData(REveRenderData &rd);
0075
0076 void BuildFromComposite(TGeoCompositeShape *cshp, Int_t n_seg = 60);
0077 void BuildFromShape(TGeoShape *shape, Int_t n_seg = 60);
0078
0079 void EnforceTriangles();
0080 void CalculateNormals();
0081
0082 const TBuffer3D& GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override;
0083 TBuffer3D *MakeBuffer3D() const override;
0084
0085 static void SetAutoEnforceTriangles(Bool_t f);
0086 static Bool_t GetAutoEnforceTriangles();
0087 static void SetAutoCalculateNormals(Bool_t f);
0088 static Bool_t GetAutoCalculateNormals();
0089
0090 ClassDefOverride(REveGeoPolyShape, 1);
0091 };
0092
0093 }}
0094
0095 #endif