ROOT logo
#ifndef ALIMUONPOLYGON_H
#define ALIMUONPOLYGON_H

/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice                               */

// $Id$

/// \ingroup geometry
/// \class AliMUONPolygon
/// \brief A planar polygon
/// 
// author Laurent Aphecetche

#ifndef ROOT_TObject
#  include "TObject.h"
#endif

class AliMUONPolygon : public TObject
{
public:
  AliMUONPolygon(Int_t nvertices=5);
  AliMUONPolygon(Double_t xpos, Double_t ypos, Double_t halfsizex, Double_t halfsizey);
  AliMUONPolygon(const AliMUONPolygon& rhs);
  AliMUONPolygon& operator=(const AliMUONPolygon& rhs);
  virtual ~AliMUONPolygon();

  /// Create a full copy of this object
  virtual TObject* Clone(const char* /*newname*/="") const { return new AliMUONPolygon(*this); }
  
  Bool_t Contains(Double_t x, Double_t y) const;
  
  Double_t SignedArea() const;
  
  /// Whether this polygon is oriented counter clockwise
  Bool_t IsCounterClockwiseOriented() const { return SignedArea() > 0.0; }
  
  void ReverseOrientation();
  
  void SetVertex(Int_t i, Double_t x, Double_t y);

  /// Return the x-coordinate of the i-th vertex
  Double_t X(Int_t i) const { return fX[i]; }

  /// Return the y-coordinate of the i-th vertex
  Double_t Y(Int_t i) const { return fY[i]; }

  /// Get the number of vertices of this polygon
  Int_t NumberOfVertices() const { return fN; }
  
  void Print(Option_t* opt="") const;
  
  void Close();
  
private:
  Int_t fN; ///< Number of vertices 
  
  /// Vertices x coordinates
  Double_t* fX; //[fN]
  
  /// Vertices y coordinates
  Double_t* fY; //[fN]
  
  ClassDef(AliMUONPolygon,1) // A simple polygon
};

#endif
 AliMUONPolygon.h:1
 AliMUONPolygon.h:2
 AliMUONPolygon.h:3
 AliMUONPolygon.h:4
 AliMUONPolygon.h:5
 AliMUONPolygon.h:6
 AliMUONPolygon.h:7
 AliMUONPolygon.h:8
 AliMUONPolygon.h:9
 AliMUONPolygon.h:10
 AliMUONPolygon.h:11
 AliMUONPolygon.h:12
 AliMUONPolygon.h:13
 AliMUONPolygon.h:14
 AliMUONPolygon.h:15
 AliMUONPolygon.h:16
 AliMUONPolygon.h:17
 AliMUONPolygon.h:18
 AliMUONPolygon.h:19
 AliMUONPolygon.h:20
 AliMUONPolygon.h:21
 AliMUONPolygon.h:22
 AliMUONPolygon.h:23
 AliMUONPolygon.h:24
 AliMUONPolygon.h:25
 AliMUONPolygon.h:26
 AliMUONPolygon.h:27
 AliMUONPolygon.h:28
 AliMUONPolygon.h:29
 AliMUONPolygon.h:30
 AliMUONPolygon.h:31
 AliMUONPolygon.h:32
 AliMUONPolygon.h:33
 AliMUONPolygon.h:34
 AliMUONPolygon.h:35
 AliMUONPolygon.h:36
 AliMUONPolygon.h:37
 AliMUONPolygon.h:38
 AliMUONPolygon.h:39
 AliMUONPolygon.h:40
 AliMUONPolygon.h:41
 AliMUONPolygon.h:42
 AliMUONPolygon.h:43
 AliMUONPolygon.h:44
 AliMUONPolygon.h:45
 AliMUONPolygon.h:46
 AliMUONPolygon.h:47
 AliMUONPolygon.h:48
 AliMUONPolygon.h:49
 AliMUONPolygon.h:50
 AliMUONPolygon.h:51
 AliMUONPolygon.h:52
 AliMUONPolygon.h:53
 AliMUONPolygon.h:54
 AliMUONPolygon.h:55
 AliMUONPolygon.h:56
 AliMUONPolygon.h:57
 AliMUONPolygon.h:58
 AliMUONPolygon.h:59
 AliMUONPolygon.h:60
 AliMUONPolygon.h:61
 AliMUONPolygon.h:62
 AliMUONPolygon.h:63
 AliMUONPolygon.h:64
 AliMUONPolygon.h:65
 AliMUONPolygon.h:66
 AliMUONPolygon.h:67