83 Fatal(
"Ctor",
"Invalid number of vertices %i", nvert);
118 for (ic=0; ic<
fNvert; ic++) {
121 area += 0.5*(
fX[i]*
fY[j]-
fX[j]*
fY[i]);
137 for (i=0; i<nd; i++) {
197 Int_t indnext, indback;
202 if (nskip<0) nskip+=
fNvert;
212 indback =
fIndc[indnext]-1;
213 if (indback < 0) indback+=
fNvert;
214 while (indback !=
fIndc[indconv]) {
217 if (indback < 0) indback+=
fNvert;
252 (point[1]-
fY[ind1])*(
fX[ind2]-
fX[ind1]);
254 if (dot<-1.E-10)
return kFALSE;
263 if (i2<0) i2=(i1+1)%
fNvert;
266 if (i==i1 || i==i2)
continue;
286 if (i==0 && j==(
fNvert-1))
continue;
296 Error(
"IsIllegalCheck",
"Illegal crossing of segment %d vs. segment %d", i,j);
317 if (iseg+2 >
fNvert)
break;
340 if (ivnew<iseg)
break;
345 Fatal(
"OutscribedConvex",
"cannot build outscribed convex");
360 Double_t lsq, ssq, dx, dy, dpx, dpy, u;
363 for (i1=0; i1<
fNvert; i1++) {
376 dpx = point[0] - p1[0];
377 dpy = point[1] - p1[1];
381 ssq = dpx*dpx + dpy*dpy;
388 u = (dpx*dx + dpy*dy)/lsq;
390 dpx = point[0]-p2[0];
391 dpy = point[1]-p2[1];
398 ssq = dpx*dpx + dpy*dpy;
422 Error(
"SetNextIndex",
"all indices already set");
427 if (!
fX || !
fY)
return;
451 for (i=0; i<nd; i++) {
static const double x2[5]
static const double x4[22]
static const double x1[5]
static const double x3[11]
R__EXTERN TGeoManager * gGeoManager
TVirtualGeoPainter * GetGeomPainter()
Make a default painter if none present. Returns pointer to it.
An arbitrary polygon defined by vertices.
Bool_t IsSegConvex(Int_t i1, Int_t i2=-1) const
Check if a segment [0..fNvert-1] belongs to the outscribed convex pgon.
TGeoPolygon()
Dummy constructor.
Double_t Safety(const Double_t *point, Int_t &isegment) const
Compute minimum distance from POINT to any segment. Returns segment index.
void SetXY(Double_t *x, Double_t *y)
Set X/Y array pointer for the polygon and daughters.
Double_t Area() const
Computes area of the polygon in [length^2].
Bool_t Contains(const Double_t *point) const
Check if a point given by X = point[0], Y = point[1] is inside the polygon.
Bool_t IsIllegalCheck() const
Check for illegal crossings between non-consecutive segments.
void GetVertices(Double_t *x, Double_t *y) const
Fill list of vertices into provided arrays.
void SetNextIndex(Int_t index=-1)
Sets the next polygone index.
virtual void Draw(Option_t *option="")
Draw the polygon.
virtual ~TGeoPolygon()
Destructor.
Double_t * fY
pointer to list of current X coordinates of vertices
Bool_t IsClockwise() const
void OutscribedConvex()
Compute indices for the outscribed convex polygon.
Bool_t IsRightSided(const 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.
void ConvexCheck()
Check polygon convexity.
TObjArray * fDaughters
pointer to list of current Y coordinates of vertices
void GetConvexVertices(Double_t *x, Double_t *y) const
Fill list of vertices of the convex outscribed polygon into provided arrays.
void FinishPolygon()
Decompose polygon in a convex outscribed part and a list of daughter polygons that have to be subtrac...
void SetConvex(Bool_t flag=kTRUE)
static Bool_t IsSegCrossing(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Double_t x3, Double_t y3, Double_t x4, Double_t y4)
Check if segments (A,B) and (C,D) are crossing, where: A(x1,y1), B(x2,y2), C(x3,y3),...
static Bool_t IsSameWithinTolerance(Double_t a, Double_t b)
Check if two numbers differ with less than a tolerance.
Int_t GetEntriesFast() const
TObject * UncheckedAt(Int_t i) const
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
TObject * At(Int_t idx) const
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
virtual void DrawPolygon(const TGeoPolygon *poly)=0
Double_t Sqrt(Double_t x)