class TGeoPolygon: public TObject

 TGeoPolygon - Arbitrary polygon class


 A polygon is a 2D shape defined by vertices in the XY plane. It is used by
 TGeoXtru class for computing Contains() and Safety(). Only the pointers to
 the actual lists of XY values are used - these are not owned by the class.

 To check if a point in XY plane is contained by a polygon, this is splitted
 into an outscribed convex polygon and the remaining polygons of its subtracton
 from the outscribed one. A point is INSIDE if it is
 contained by the outscribed polygon but NOT by the remaining ones. Since these
 can also be arbitrary polygons at their turn, a tree structure is formed:

  P = Pconvex - (Pconvex-P)           where (-) means 'subtraction'
  Pconvex-P = P1 + P2 + ...           where (+) means 'union'

  *Note that P1, P2, ... do not intersect each other and they are defined
   by subsets of the list of vertices of P. They can be splitted in the same
   way as P*

 Therefore, if C(P) represents the Boolean : 'does P contains a given point?',
 then:

 C(P) = C(Pconvex) .and. not(C(P1) | C(P2) | ...)

 For creating a polygon without TGeoXtru class, one has to call the constructor
 TGeoPolygon(nvert) and then SetXY(Double_t *x, Double_t *y) providing the
 arrays of X and Y vertex positions (defined clockwise) that have to 'live' longer
 than the polygon they will describe. This complication is due to efficiency reasons.
 At the end one has to call the FinishPolygon() method.

Function Members (Methods)

public:
TGeoPolygon()
TGeoPolygon(Int_t nvert)
TGeoPolygon(const TGeoPolygon&)
virtual~TGeoPolygon()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
Double_tArea() const
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
Bool_tContains(Double_t* point) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
voidFinishPolygon()
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual const char*TObject::GetName() const
Int_tGetNvert() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
Double_t*GetX()
Double_t*GetY()
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
Bool_tIsClockwise() const
Bool_tIsConvex() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
Bool_tIsFinished() const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TGeoPolygon&operator=(const TGeoPolygon&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
Double_tSafety(Double_t* point, Int_t& isegment) const
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetConvex(Bool_t flag = kTRUE)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidSetNextIndex(Int_t index = -1)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTObject::SetUniqueID(UInt_t uid)
voidSetXY(Double_t* x, Double_t* y)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
private:
voidConvexCheck()
Bool_tIsRightSided(Double_t* point, Int_t ind1, Int_t ind2) const
Bool_tIsSegConvex(Int_t i1, Int_t i2 = -1) const
voidOutscribedConvex()

Data Members

public:
enum { kGeoConvex
kGeoFinishPolygon
kGeoACW
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
TObjArray*fDaughterslist of concave daughters
Int_t*fInd[fNvert] list of vertex indices
Int_t*fIndc[fNconvex] indices of vertices of the outscribed convex polygon
Int_tfNconvexnumber of points of the outscribed convex polygon
Int_tfNvertnumber of vertices (must be defined clockwise in XY plane)
Double_t*fX! pointer to list of current X coordinates of vertices
Double_t*fY! pointer to list of current Y coordinates of vertices

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TGeoPolygon()
 Dummy constructor.
TGeoPolygon(Int_t nvert)
 Default constructor.
~TGeoPolygon()
 Destructor
Double_t Area()
 Computes area of the polygon in [length^2].
Bool_t Contains(Double_t* point) const
 Check if a point given by X = point[0], Y = point[1] is inside the polygon.
void ConvexCheck()
 Check polygon convexity.
void FinishPolygon()
 Decompose polygon in a convex outscribed part and a list of daughter
 polygons that have to be substracted to get the actual one.
Bool_t IsRightSided(Double_t* point, Int_t ind1, Int_t ind2) const
 Check if POINT is right-sided with respect to the segment defined by IND1 and IND2.
Bool_t IsSegConvex(Int_t i1, Int_t i2 = -1) const
 Check if a segment [0..fNvert-1] belongs to the outscribed convex pgon.
void OutscribedConvex()
 Compute indices for the outscribed convex polygon.
Double_t Safety(Double_t* point, Int_t& isegment) const
 Compute minimum distance from POINT to any segment. Returns segment index.
void SetNextIndex(Int_t index = -1)
 Sets the next polygone index. If index<0 sets all indices consecutive
 in increasing order.
void SetXY(Double_t* x, Double_t* y)
 Set X/Y array pointer for the polygon and daughters.
TGeoPolygon()
 constructors
Int_t GetNvert()
{return fNvert;}
Double_t * GetX()
{return fX;}
Double_t * GetY()
{return fY;}
Bool_t IsClockwise()
{return !TObject::TestBit(kGeoACW);}
Bool_t IsConvex()
{return TObject::TestBit(kGeoConvex);}
Bool_t IsFinished()
{return TObject::TestBit(kGeoFinishPolygon);}
void SetConvex(Bool_t flag = kTRUE)
{TObject::SetBit(kGeoConvex,flag);}

Author: Mihaela Gheata 05/01/04
Last change: root/geom:$Id: TGeoPolygon.h 21425 2007-12-17 15:59:27Z brun $
Last generated: 2008-06-25 08:45
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.