]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDPolygon.h
Bugfix.
[u/mrichter/AliRoot.git] / FMD / AliFMDPolygon.h
1 #ifndef ALIFMDPOLYGON_H
2 #define ALIFMDPOLYGON_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
4  * reserved. 
5  *
6  * Latest changes by Christian Holm Christensen <cholm@nbi.dk>
7  *
8  * See cxx source for full Copyright notice                               
9  */
10 #ifndef ROOT_TVector2
11 # include <TVector2.h>
12 #endif
13 #ifndef ROOT_TObjArray
14 # include <TObjArray.h>
15 #endif
16
17 class AliFMDPolygon : public TObject 
18 {
19 public:
20   // Construct a alipolygon with N sides
21   AliFMDPolygon();
22   virtual ~AliFMDPolygon();
23
24   // Clear the polygon 
25   void Clear(Option_t* option="");
26   
27   // Add a vertex 
28   bool AddVertex(TVector2* c);
29   bool AddVertex(double x, double y);
30
31   // Get a vertex point 
32   const TVector2& GetVertex(size_t i) const;
33   
34   // Check if a point is inside the polygon 
35   bool Contains(const TVector2* c) const;
36   bool Contains(double x, double y) const;
37   
38   // Get the number of verticies 
39   size_t GetNVerticies() const { return fVerticies.GetEntries(); }  
40   // Get the coordinates 
41   const TObjArray& GetVerticies() const { return fVerticies; }
42   
43   void Draw(const char* option="PL", const char* name=0) const;
44
45 private:
46   enum {
47     kUnknown, 
48     kConvex, 
49     kConcave
50   };
51   mutable Int_t fState;
52   // List of coordinates 
53   TObjArray fVerticies;
54   // Force convexity check 
55   bool ConvexCheck() const;
56   // Check if a point is at the right-hand side of a segment 
57   bool IsOnLeftHand(const TVector2* c, size_t i1, size_t i2) const;
58
59   ClassDef(AliFMDPolygon,1) // Polygon parameters
60 };
61
62 #endif
63 //____________________________________________________________________
64 //
65 // Local Variables:
66 //   mode: C++
67 // End:
68 //
69 // EOF
70 //
71
72   
73