84 Fatal(
"Ctor",
"Invalid number of vertices %i", nvert);
121 for (ic = 0; ic <
fNvert; ic++) {
124 area += 0.5 * (
fX[i] *
fY[j] -
fX[j] *
fY[i]);
142 for (i = 0; i < nd; i++) {
207 Int_t indnext, indback;
223 indback =
fIndc[indnext] - 1;
226 while (indback !=
fIndc[indconv]) {
236 for (indconv = 0; indconv <
fNconvex; indconv++)
265 Double_t dot = (point[0] -
fX[ind1]) * (
fY[ind2] -
fY[ind1]) - (point[1] -
fY[ind1]) * (
fX[ind2] -
fX[ind1]);
282 if (i == i1 || i == i2)
305 if (i == 0 && j == (
fNvert - 1))
316 Error(
"IsIllegalCheck",
"Illegal crossing of segment %d vs. segment %d", i, j);
339 ivnew = (iseg + 2) %
fNvert;
347 ivnew = (ivnew + 1) %
fNvert;
355 ivnew = (iseg + 1) %
fNvert;
360 else if (indconv[
fNconvex - 1] != iseg)
370 Fatal(
"OutscribedConvex",
"cannot build outscribed convex");
385 Double_t lsq, ssq, dx, dy, dpx, dpy, u;
388 for (i1 = 0; i1 <
fNvert; i1++) {
401 dpx = point[0] - p1[0];
402 dpy = point[1] - p1[1];
404 lsq = dx * dx + dy * dy;
406 ssq = dpx * dpx + dpy * dpy;
413 u = (dpx * dx + dpy * dy) / lsq;
415 dpx = point[0] - p2[0];
416 dpy = point[1] - p2[1];
423 ssq = dpx * dpx + dpy * dpy;
444 for (i = 0; i <
fNvert; i++)
449 Error(
"SetNextIndex",
"all indices already set");
457 for (i = 0; i <
fNvert; i++)
475 for (i = 0; i <
fNvert; i++)
486 for (i = 0; i < nd; i++) {
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
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.
Double_t * fY
pointer to list of current X coordinates of vertices
void Draw(Option_t *option="") override
Draw the polygon.
Bool_t IsClockwise() const
void OutscribedConvex()
Compute indices for the outscribed convex polygon.
~TGeoPolygon() override
Destructor.
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
void Delete(Option_t *option="") override
Remove all objects from the array AND delete all heap based objects.
TObject * At(Int_t idx) const override
TObject * UncheckedAt(Int_t i) const
void Add(TObject *obj) override
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)
Returns the square root of x.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.