File indexing completed on 2025-01-18 10:11:42
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TEvePolygonSetProjected
0013 #define ROOT_TEvePolygonSetProjected
0014
0015 #include "TEveVector.h"
0016 #include "TEveShape.h"
0017 #include <list>
0018
0019 class TBuffer3D;
0020
0021 class TEvePolygonSetProjected : public TEveShape,
0022 public TEveProjected
0023 {
0024 friend class TEvePolygonSetProjectedGL;
0025 friend class TEvePolygonSetProjectedEditor;
0026
0027 private:
0028 TEvePolygonSetProjected(const TEvePolygonSetProjected&) = delete;
0029 TEvePolygonSetProjected& operator=(const TEvePolygonSetProjected&) = delete;
0030
0031 protected:
0032 struct Polygon_t
0033 {
0034 Int_t fNPnts;
0035 Int_t* fPnts;
0036
0037 Polygon_t() : fNPnts(0), fPnts(nullptr) {}
0038 virtual ~Polygon_t() { delete [] fPnts; fNPnts = 0; fPnts = nullptr; }
0039
0040 Polygon_t& operator=(const Polygon_t& x)
0041 { fNPnts = x.fNPnts; fPnts = x.fPnts; return *this; }
0042
0043 Int_t FindPoint(Int_t pi)
0044 {
0045 for (Int_t i=0; i<fNPnts; ++i) {
0046 if (fPnts[i] == pi) return i;
0047 }
0048 return -1;
0049 }
0050 };
0051
0052 typedef std::list<Polygon_t> vpPolygon_t;
0053 typedef vpPolygon_t::iterator vpPolygon_i;
0054 typedef vpPolygon_t::const_iterator vpPolygon_ci;
0055
0056 private:
0057 TBuffer3D* fBuff;
0058
0059 Bool_t IsFirstIdxHead(Int_t s0, Int_t s1);
0060 Float_t AddPolygon(std::list<Int_t, std::allocator<Int_t> >& pp, std::list<Polygon_t, std::allocator<Polygon_t> >& p);
0061
0062 Int_t* ProjectAndReducePoints();
0063 Float_t MakePolygonsFromBP(Int_t* idxMap);
0064 Float_t MakePolygonsFromBS(Int_t* idxMap);
0065
0066 protected:
0067 vpPolygon_t fPols;
0068 vpPolygon_t fPolsBS;
0069 vpPolygon_t fPolsBP;
0070
0071 Int_t fNPnts;
0072 TEveVector* fPnts;
0073
0074 void SetDepthLocal(Float_t d) override;
0075
0076 Float_t PolygonSurfaceXY(const Polygon_t& poly) const;
0077
0078 public:
0079 TEvePolygonSetProjected(const char* n="TEvePolygonSetProjected", const char* t="");
0080 ~TEvePolygonSetProjected() override;
0081
0082 void ComputeBBox() override;
0083
0084 void SetProjection(TEveProjectionManager* mng, TEveProjectable* model) override;
0085 void UpdateProjection() override;
0086 TEveElement* GetProjectedAsElement() override { return this; }
0087
0088 void ProjectBuffer3D();
0089
0090 virtual void DumpPolys() const;
0091 void DumpBuffer3D();
0092
0093 ClassDefOverride(TEvePolygonSetProjected,0);
0094
0095 };
0096
0097 #endif