library: libGeom #include "TGeoPolygon.h" |
TGeoPolygon
class description - header file - source file - inheritance tree (.pdf)
private:
void ConvexCheck()
Bool_t IsRightSided(Double_t* point, Int_t ind1, Int_t ind2) const
Bool_t IsSegConvex(Int_t i1, Int_t i2 = -1) const
void OutscribedConvex()
public:
TGeoPolygon()
TGeoPolygon(Int_t nvert)
TGeoPolygon(const TGeoPolygon&)
virtual ~TGeoPolygon()
Double_t Area() const
static TClass* Class()
Bool_t Contains(Double_t* point) const
void FinishPolygon()
Int_t GetNvert() const
Double_t* GetX()
Double_t* GetY()
virtual TClass* IsA() const
Bool_t IsClockwise() const
Bool_t IsConvex() const
Bool_t IsFinished() const
TGeoPolygon& operator=(const TGeoPolygon&)
Double_t Safety(Double_t* point, Int_t& isegment) const
void SetConvex(Bool_t flag = kTRUE)
void SetNextIndex(Int_t index = -1)
void SetXY(Double_t* x, Double_t* y)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
protected:
Int_t fNvert number of vertices (must be defined clockwise in XY plane)
Int_t fNconvex number of points of the outscribed convex polygon
Int_t* fInd [fNvert] list of vertex indices
Int_t* fIndc [fNconvex] indices of vertices of the outscribed convex polygon
Double_t* fX ! pointer to list of current X coordinates of vertices
Double_t* fY ! pointer to list of current Y coordinates of vertices
TObjArray* fDaughters list of concave daughters
public:
static const enum TGeoPolygon:: kGeoConvex
static const enum TGeoPolygon:: kGeoFinishPolygon
static const enum TGeoPolygon:: kGeoACW
____________________________________________________________________________
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.
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.
void SetNextIndex(Int_t index)
Sets the next polygone index. If index<0 sets all indices consecutive
in increasing order.
Author: Mihaela Gheata 5/01/04
Last update: root/geom:$Name: $:$Id: TGeoPolygon.cxx,v 1.7 2006/04/03 16:19:31 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Class Hierarchy - Top of the page
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.