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