From 2526f6543ace59f55be60910cc8edaa4d57a82bb Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Mon, 20 Oct 2025 10:22:34 +0200 Subject: [PATCH 1/2] [graf2d] use Pi constants for exclusion area painting --- hist/histpainter/src/TGraphPainter.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hist/histpainter/src/TGraphPainter.cxx b/hist/histpainter/src/TGraphPainter.cxx index 2adc17f5fa98e..d8106d54ee341 100644 --- a/hist/histpainter/src/TGraphPainter.cxx +++ b/hist/histpainter/src/TGraphPainter.cxx @@ -4696,13 +4696,13 @@ void TGraphPainter::PaintPolyLineHatches(TGraph *theGraph, Int_t n, const Double } else { a1 = TMath::ATan((yi1-yi0)/(xi1-xi0)); } - if (xi1 Date: Mon, 20 Oct 2025 10:39:59 +0200 Subject: [PATCH 2/2] [graf2d] Use epsilon for exclusion points optimization To avoid rounding effects in TGraph exclusion points optimization, use small epsilon in values comparasion. --- hist/histpainter/src/TGraphPainter.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hist/histpainter/src/TGraphPainter.cxx b/hist/histpainter/src/TGraphPainter.cxx index d8106d54ee341..eb51453dd2bb6 100644 --- a/hist/histpainter/src/TGraphPainter.cxx +++ b/hist/histpainter/src/TGraphPainter.cxx @@ -4754,20 +4754,21 @@ void TGraphPainter::PaintPolyLineHatches(TGraph *theGraph, Int_t n, const Double Double_t xc, yc, c1, b1, c2, b2; Bool_t cross = kFALSE; Int_t nf2 = nf; + const Double_t eps = 1e-12; // float precision for (i=nf2; i>0; i--) { for (j=i-1; j>0; j--) { - if (xt[i-1]==xt[i] || xt[j-1]==xt[j]) continue; + if (TMath::Abs(xt[i-1]-xt[i]) < eps || TMath::Abs(xt[j-1]-xt[j]) < eps) continue; c1 = (yt[i-1]-yt[i])/(xt[i-1]-xt[i]); b1 = yt[i]-c1*xt[i]; c2 = (yt[j-1]-yt[j])/(xt[j-1]-xt[j]); b2 = yt[j]-c2*xt[j]; - if (c1 != c2) { + if (TMath::Abs(c1 - c2) > eps) { xc = (b2-b1)/(c1-c2); yc = c1*xc+b1; - if (xc>TMath::Min(xt[i],xt[i-1]) && xcTMath::Min(xt[j],xt[j-1]) && xcTMath::Min(yt[i],yt[i-1]) && ycTMath::Min(yt[j],yt[j-1]) && ycTMath::Min(xt[i],xt[i-1])+eps && xcTMath::Min(xt[j],xt[j-1])+eps && xcTMath::Min(yt[i],yt[i-1])+eps && ycTMath::Min(yt[j],yt[j-1])+eps && yc