Changeset 2517 in Sophya for trunk/SophyaPI/PIext/pintuple.cc
- Timestamp:
- Mar 17, 2004, 7:04:57 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/pintuple.cc
r2469 r2517 4 4 5 5 #include <stdio.h> 6 #include <stdlib.h> 7 #include <iostream> 8 #include <math.h> 6 9 #include "pintuple.h" 7 10 … … 55 58 SelectLabel(NULL); 56 59 SetName("NTupleDrw"); 60 NptDraw = 0; 61 57 62 } 58 63 … … 189 194 xp = yp = xl = yl = 0; 190 195 PIGrCoord xpolyg[NMXMULTP_LOCAL], ypolyg[NMXMULTP_LOCAL]; 191 npolyg = 0; 196 npolyg = 0; 197 NptDraw = 0; 192 198 for (long i=0; i<(long)mNT->NbLines(); i++) { 193 199 xl = xp; yl = yp; … … 198 204 if ( (xp < xmin) || (xp > xmax) || (yp < ymin) || (yp > ymax) ) continue; 199 205 206 NptDraw++; 200 207 // Taille - couleur de marker en fonction du poids 201 208 if (wK >= 0) wp = mNT->GetCell(i, wK); … … 391 398 392 399 393 400 /* --Methode-- */ 401 double PINTuple::GetDistanceToPoint(double x, double y) 402 { 403 if(!mNT) return 1.e+9; 404 if( xK<0 || yK<0 ) return 1.e+9; 405 406 const int nessai = 100; 407 long inc = (NptDraw>nessai) ? (long)(NptDraw/nessai)+1 : 1; 408 409 double dist = -1.e+18; 410 long n = 0; 411 for(long i=0; i<(long)mNT->NbLines(); i++) { 412 double xp=mNT->GetCell(i,xK); 413 if(xp<XMin() || xp>XMax()) continue; 414 double yp=mNT->GetCell(i,yK); 415 if(yp<YMin() || yp>YMax()) continue; 416 if(n%inc==0) { 417 xp = (xp-x)/(XMax()-XMin())/0.5; 418 yp = (yp-y)/(YMax()-YMin())/0.5; 419 xp = xp*xp+yp*yp; 420 if(dist<0. || xp<dist) dist = xp; 421 } 422 n++; 423 } 424 dist=sqrt(fabs(dist)); 425 //cout<<"PINTuple: xlim="<<XMin()<<","<<XMax()<<" ylim="<<YMin()<<","<<YMax() 426 // <<" NbLines="<<mNT->NbLines()<<" inc="<<inc<<endl; 427 //cout<<"....d="<<dist<<" x="<<x<<" y="<<y<<" NptDraw="<<NptDraw<<endl; 428 429 return dist; 430 }
Note:
See TracChangeset
for help on using the changeset viewer.