File indexing completed on 2025-01-18 10:11:54
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGeoPolygon
0013 #define ROOT_TGeoPolygon
0014
0015 #include "TObject.h"
0016
0017 class TObjArray;
0018
0019 class TGeoPolygon : public TObject {
0020 public:
0021 enum { kGeoConvex = BIT(9), kGeoFinishPolygon = BIT(10), kGeoACW = BIT(11) };
0022
0023 protected:
0024
0025 Int_t fNvert{0};
0026 Int_t fNconvex{0};
0027 Int_t *fInd{nullptr};
0028 Int_t *fIndc{nullptr};
0029 Double_t *fX{nullptr};
0030 Double_t *fY{nullptr};
0031 TObjArray *fDaughters{nullptr};
0032 private:
0033 void ConvexCheck();
0034 Bool_t IsSegConvex(Int_t i1, Int_t i2 = -1) const;
0035 Bool_t IsRightSided(const Double_t *point, Int_t ind1, Int_t ind2) const;
0036 void OutscribedConvex();
0037
0038 TGeoPolygon(const TGeoPolygon &) = delete;
0039 TGeoPolygon &operator=(const TGeoPolygon &) = delete;
0040
0041 public:
0042
0043 TGeoPolygon();
0044 TGeoPolygon(Int_t nvert);
0045
0046 ~TGeoPolygon() override;
0047
0048 Double_t Area() const;
0049 Bool_t Contains(const Double_t *point) const;
0050 void Draw(Option_t *option = "") override;
0051 void FinishPolygon();
0052 Int_t GetNvert() const { return fNvert; }
0053 Int_t GetNconvex() const { return fNconvex; }
0054 Double_t *GetX() { return fX; }
0055 Double_t *GetY() { return fY; }
0056 void GetVertices(Double_t *x, Double_t *y) const;
0057 void GetConvexVertices(Double_t *x, Double_t *y) const;
0058 Bool_t IsClockwise() const { return !TObject::TestBit(kGeoACW); }
0059 Bool_t IsConvex() const { return TObject::TestBit(kGeoConvex); }
0060 Bool_t IsFinished() const { return TObject::TestBit(kGeoFinishPolygon); }
0061 Bool_t IsIllegalCheck() const;
0062 Double_t Safety(const Double_t *point, Int_t &isegment) const;
0063 void SetConvex(Bool_t flag = kTRUE) { TObject::SetBit(kGeoConvex, flag); }
0064 void SetXY(Double_t *x, Double_t *y);
0065 void SetNextIndex(Int_t index = -1);
0066
0067 ClassDefOverride(TGeoPolygon, 2)
0068 };
0069
0070 #endif