83 Fatal(
"Ctor",
"Invalid number of vertices %i", nvert);
120 for (ic = 0; ic <
fNvert; ic++) {
123 area += 0.5 * (
fX[i] *
fY[j] -
fX[j] *
fY[i]);
141 for (i = 0; i < nd; i++) {
206 Int_t indnext, indback;
222 indback =
fIndc[indnext] - 1;
225 while (indback !=
fIndc[indconv]) {
235 for (indconv = 0; indconv <
fNconvex; indconv++)
264 Double_t dot = (point[0] -
fX[ind1]) * (
fY[ind2] -
fY[ind1]) - (point[1] -
fY[ind1]) * (
fX[ind2] -
fX[ind1]);
281 if (i == i1 || i == i2)
299 Double_t x1, y1, x2, y2, x3, y3, x4, y4;
304 if (i == 0 && j == (
fNvert - 1))
315 Error(
"IsIllegalCheck",
"Illegal crossing of segment %d vs. segment %d", i, j);
338 ivnew = (iseg + 2) %
fNvert;
346 ivnew = (ivnew + 1) %
fNvert;
354 ivnew = (iseg + 1) %
fNvert;
359 else if (indconv[
fNconvex - 1] != iseg)
369 Fatal(
"OutscribedConvex",
"cannot build outscribed convex");
384 Double_t lsq, ssq, dx, dy, dpx, dpy, u;
387 for (i1 = 0; i1 <
fNvert; i1++) {
400 dpx = point[0] - p1[0];
401 dpy = point[1] - p1[1];
403 lsq = dx * dx + dy * dy;
405 ssq = dpx * dpx + dpy * dpy;
412 u = (dpx * dx + dpy * dy) / lsq;
414 dpx = point[0] - p2[0];
415 dpy = point[1] - p2[1];
422 ssq = dpx * dpx + dpy * dpy;
443 for (i = 0; i <
fNvert; i++)
448 Error(
"SetNextIndex",
"all indices already set");
456 for (i = 0; i <
fNvert; i++)
474 for (i = 0; i <
fNvert; i++)
485 for (i = 0; i < nd; i++) {
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
const char Option_t
Option string (const char).
externTGeoManager * gGeoManager
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 Y 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.
Double_t * fX
! pointer to list of current X coordinates of vertices
~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.
TGeoPolygon(const TGeoPolygon &)=delete
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.
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.
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.