Changeset 2517 in Sophya for trunk/SophyaPI/PIext/pigfd1.cc
- Timestamp:
- Mar 17, 2004, 7:04:57 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/pigfd1.cc
r2115 r2517 10 10 SelectX(0); 11 11 SelectErrBar(false,false); 12 NptDraw = 0; 12 13 } 13 14 … … 60 61 if(GetGraphicAtt().GetLineAtt()!=PI_NotDefLineAtt) SelectErrBar(true,true); 61 62 double xp,yp,er; 63 NptDraw = 0; 62 64 for (int i=0; i<mGFD->NData(); i++) { 63 65 xp = mGFD->Absc(VarX,i); 64 66 yp = mGFD->Val(i); 65 67 if(xp<xmin || xp>xmax || yp<ymin || yp>ymax) continue; 68 NptDraw++; 66 69 if(ErrX) { 67 70 er = mGFD->EAbsc(VarX,i); … … 76 79 return; 77 80 } 81 82 /* --Methode-- */ 83 double PIGenFitDat::GetDistanceToPoint(double x, double y) 84 { 85 if(!mGFD) return 1.e+9; 86 if(mGFD->NData()<=0) return 1.e+9; 87 if(VarX<0) return 1.e+9; 88 89 const int nessai = 100; 90 long inc = (NptDraw>nessai) ? (long)(NptDraw/nessai)+1 : 1; 91 92 double dist = -1.e+18; 93 long n = 0; 94 for(long i=0; i<mGFD->NData(); i++) { 95 double xp=mGFD->Absc(VarX,i); 96 if(xp<XMin() || xp>XMax()) continue; 97 double yp=mGFD->Val(i); 98 if(yp<YMin() || yp>YMax()) continue; 99 if(n%inc==0) { 100 xp = (xp-x)/(XMax()-XMin())/0.5; 101 yp = (yp-y)/(YMax()-YMin())/0.5; 102 xp = xp*xp+yp*yp; 103 if(dist<0. || xp<dist) dist = xp; 104 } 105 n++; 106 } 107 dist=sqrt(fabs(dist)); 108 //cout<<"PIGenFitDat: xlim="<<XMin()<<","<<XMax()<<" ylim="<<YMin()<<","<<YMax() 109 // <<" NData="<<mGFD->NData()<<" inc="<<inc<<endl; 110 //cout<<"....d="<<dist<<" x="<<x<<" y="<<y<<" NptDraw="<<NptDraw<<endl; 111 112 return dist; 113 }
Note:
See TracChangeset
for help on using the changeset viewer.