]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONPolygon.h
ConsistencyCheck() rewritten.
[u/mrichter/AliRoot.git] / MUON / AliMUONPolygon.h
1 #ifndef ALIMUONPOLYGON_H
2 #define ALIMUONPOLYGON_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice                               */
6
7 // $Id$
8
9 /// \ingroup geometry
10 /// \class AliMUONPolygon
11 /// \brief A planar polygon
12 /// 
13 // author Laurent Aphecetche
14
15 #ifndef ROOT_TObject
16 #  include "TObject.h"
17 #endif
18
19 class AliMUONPolygon : public TObject
20 {
21 public:
22   AliMUONPolygon(Int_t nvertices=5);
23   AliMUONPolygon(Double_t xpos, Double_t ypos, Double_t halfsizex, Double_t halfsizey);
24   AliMUONPolygon(const AliMUONPolygon& rhs);
25   AliMUONPolygon& operator=(const AliMUONPolygon& rhs);
26   virtual ~AliMUONPolygon();
27
28   virtual TObject* Clone(const char* /*newname*/="") const { return new AliMUONPolygon(*this); }
29   
30   Bool_t Contains(Double_t x, Double_t y) const;
31   
32   Double_t SignedArea() const;
33   
34   /// Whether this polygon is oriented counter clockwise
35   Bool_t IsCounterClockwiseOriented() const { return SignedArea() > 0.0; }
36   
37   void ReverseOrientation();
38   
39   void SetVertex(Int_t i, Double_t x, Double_t y);
40
41   Double_t X(Int_t i) const { return fX[i]; }
42
43   Double_t Y(Int_t i) const { return fY[i]; }
44
45   Int_t NumberOfVertices() const { return fN; }
46   
47   void Print(Option_t* opt="") const;
48   
49   void Copy(TObject& obj) const;
50   
51   void Close();
52   
53 private:
54   Int_t fN; ///< Number of vertices 
55   Double_t* fX; //[fN]
56   Double_t* fY; //[fN]
57   
58   ClassDef(AliMUONPolygon,1) // A simple polygon
59 };
60
61 #endif