15 ClassImp(TPoints3DABC);
26 Int_t TPoints3DABC::Add(Float_t x, Float_t y, Float_t z)
28 return AddLast(x,y,z);
35 Int_t TPoints3DABC::AddLast(Float_t x, Float_t y, Float_t z)
37 return SetNextPoint(x,y,z);
75 Int_t TPoints3DABC::DistancetoLine(Int_t px, Int_t py, Float_t x1, Float_t y1, Float_t x2, Float_t y2, Int_t lineWidth )
77 Float_t xl, xt, yl, yt;
80 if (x1 < x2) {xl = x1; xt = x2;}
81 else {xl = x2; xt = x1;}
82 if (y1 < y2) {yl = y1; yt = y2;}
83 else {yl = y2; yt = y1;}
84 if (x < xl-2 || x> xt+2)
return 9999;
85 if (y < yl-2 || y> yt+2)
return 9999;
88 Float_t x1x2 = x1 - x2;
91 Float_t y1y2 = y1 - y2;
92 Float_t a2 = xx1*xx1 + yy1*yy1;
93 Float_t b2 = xx2*xx2 + yy2*yy2;
94 Float_t c2 = x1x2*x1x2 + y1y2*y1y2;
95 if (c2 <= 0)
return 9999;
96 Float_t c = TMath::Sqrt(c2);
97 Float_t u = (a2 - b2 + c2)/(2*c);
98 Float_t d2 = TMath::Abs(a2 - u*u);
99 if (d2 < 0)
return 9999;
101 return Int_t(TMath::Sqrt(d2) - 0.5*
float(lineWidth));
108 Int_t TPoints3DABC::SetNextPoint(Float_t x, Float_t y, Float_t z)
110 return SetPoint(GetLastPosition()+1,x,y,z);
119 Int_t TPoints3DABC::GetN()
const
131 Float_t *TPoints3DABC::GetP()
const
150 Float_t *TPoints3DABC::GetXYZ(Float_t *xyz,Int_t idx,Int_t num)
const
153 Int_t size = TMath::Min(idx+num,Size());
155 for (Int_t i=idx;i<size;i++) {