12 #include "Riostream.h"
14 #include "TPointsArray3D.h"
15 #include "TVirtualPad.h"
83 fP =
new Float_t[3*fN];
84 memset(fP,0,3*fN*
sizeof(Float_t));
100 fP =
new Float_t[3*fN];
102 memcpy(fP,p,3*fN*
sizeof(Float_t));
105 memset(fP,0,3*fN*
sizeof(Float_t));
125 fP =
new Float_t[3*fN];
128 for (Int_t i=0; i<n;i++) {
135 memset(fP,0,3*fN*
sizeof(Float_t));
149 if (fP)
delete [] fP;
158 fN(point.fN),fP(0),fGLList(point.fGLList),fLastPoint(point.fLastPoint)
174 for (Int_t i=0; i<3*fN;i++) {((
TPointsArray3D&)obj).fP[i] = fP[i];}
190 const Int_t inaxis = 7;
193 Int_t puxmin = gPad->XtoAbsPixel(gPad->GetUxmin());
194 Int_t puymin = gPad->YtoAbsPixel(gPad->GetUymin());
195 Int_t puxmax = gPad->XtoAbsPixel(gPad->GetUxmax());
196 Int_t puymax = gPad->YtoAbsPixel(gPad->GetUymax());
199 if (px < puxmin - inaxis)
return Int_t (dist);
200 if (py > puymin + inaxis)
return Int_t (dist);
201 if (px > puxmax + inaxis)
return Int_t (dist);
202 if (py < puymax - inaxis)
return Int_t (dist);
204 TView *view = gPad->GetView();
205 if (!view)
return Int_t(dist);
211 for (i=0;i<size;i++) {
212 view->WCtoNDC(&fP[3*i], xndc);
213 x1 = gPad->XtoAbsPixel(xndc[0]);
214 y1 = gPad->YtoAbsPixel(xndc[1]);
215 dpoint = (px-x1)*(px-x1) + (py-y1)*(py-y1);
216 if (dpoint < dist) dist = dpoint;
218 return Int_t(TMath::Sqrt(dist));
228 gPad->GetView()->ExecuteRotateView(event, px, py);
236 TROOT::IndentLevel();
237 std::cout << IsA()->GetName() <<
" N=" <<fN<<
" Option="<<option<<std::endl;
245 std::cout <<
" " << IsA()->GetName() <<
" Printing N=" <<fN<<
" Option="<<option<<std::endl;
252 fLastPoint = TMath::Min(idx,GetN()-1);
266 if (!fP || n >= fN) {
268 Int_t step = TMath::Max(10, fN/4);
269 Float_t *savepoint =
new Float_t [3*(fN+step)];
271 memcpy(savepoint,fP,3*fN*
sizeof(Float_t));
280 fLastPoint = TMath::Max(fLastPoint,n);
292 if (fP)
delete [] fP;
293 fP =
new Float_t[3*fN];
294 for (Int_t i=0; i<3*fN;i++) {
296 else memset(fP,0,3*fN*
sizeof(Float_t));
306 void TPointsArray3D::Streamer(TBuffer &b)
310 TObject::Streamer(b);
313 fP =
new Float_t[3*fN];
314 b.ReadFastArray(fP,3*fN);
319 b.WriteVersion(TPointsArray3D::IsA());
320 TObject::Streamer(b);
323 if (size) b.WriteFastArray(fP, 3*size);
virtual Int_t SetLastPosition(Int_t idx)
to be documented
virtual ~TPointsArray3D()
3-D PolyLine default destructor.
virtual void ls(Option_t *option="") const
List this 3-D polyline with its attributes.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
virtual Int_t SetPoints(Int_t n, Float_t *p=0, Option_t *option="")
virtual void Print(Option_t *option="") const
Dump this 3-D polyline with its attributes.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
TPointsArray3D()
3-D PolyLine default constructor.
virtual void Copy(TObject &points) const
Copy this TPointsArray3D to another.
virtual Int_t SetPoint(Int_t point, Float_t x, Float_t y, Float_t z)