]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONPolygon.h
Fixing memory leak introduced with rev. 45388
[u/mrichter/AliRoot.git] / MUON / AliMUONPolygon.h
CommitLineData
0b936dc0 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
19class AliMUONPolygon : public TObject
20{
21public:
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
ca04ed6c 28 /// Create a full copy of this object
0b936dc0 29 virtual TObject* Clone(const char* /*newname*/="") const { return new AliMUONPolygon(*this); }
30
31 Bool_t Contains(Double_t x, Double_t y) const;
32
33 Double_t SignedArea() const;
34
35 /// Whether this polygon is oriented counter clockwise
36 Bool_t IsCounterClockwiseOriented() const { return SignedArea() > 0.0; }
37
38 void ReverseOrientation();
39
40 void SetVertex(Int_t i, Double_t x, Double_t y);
41
ca04ed6c 42 /// Return the x-coordinate of the i-th vertex
0b936dc0 43 Double_t X(Int_t i) const { return fX[i]; }
44
ca04ed6c 45 /// Return the y-coordinate of the i-th vertex
0b936dc0 46 Double_t Y(Int_t i) const { return fY[i]; }
47
ca04ed6c 48 /// Get the number of vertices of this polygon
0b936dc0 49 Int_t NumberOfVertices() const { return fN; }
50
51 void Print(Option_t* opt="") const;
52
53 void Copy(TObject& obj) const;
54
55 void Close();
56
57private:
cddcc1f3 58 Int_t fN; ///< Number of vertices
52ce8802 59
60 /// Vertices x coordinates
0b936dc0 61 Double_t* fX; //[fN]
52ce8802 62
63 /// Vertices y coordinates
0b936dc0 64 Double_t* fY; //[fN]
65
66 ClassDef(AliMUONPolygon,1) // A simple polygon
67};
68
69#endif