Changeset 2517 in Sophya for trunk/SophyaPI/PIext/pi2dvec.cc


Ignore:
Timestamp:
Mar 17, 2004, 7:04:57 PM (22 years ago)
Author:
cmv
Message:

GetDistanceToPoint cmv 17/03/04

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/pi2dvec.cc

    r2322 r2517  
    169169}
    170170
     171
     172
     173/* --Methode-- */
     174double PI2dVecDrawer::GetDistanceToPoint(double x, double y)
     175{
     176 if(_nti==NULL) return 1.e+9;
     177 if( xK<0 || yK<0 ) return 1.e+9;
     178 if( vK<0 || wK<0 ) return 1.e+9;
     179
     180 double dist = -1.e+18;
     181 for(int i=0; i<_nti->NbLines(); i++) {
     182   double xp=_nti->GetCell(i,xK);
     183   double yp=_nti->GetCell(i,yK);
     184   xp = (xp-x)/(XMax()-XMin())/0.5;
     185   yp = (yp-y)/(YMax()-YMin())/0.5;
     186   xp = xp*xp+yp*yp;
     187   if(dist<0. || xp<dist) dist = xp;
     188 }
     189 dist=sqrt(fabs(dist));
     190 cout<<dist<<"PI2dVecDrawer: xlim="<<XMin()<<","<<XMax()<<" ylim="<<YMin()<<","<<YMax()
     191     <<" NbLines="<<_nti->NbLines()<<endl;
     192 cout<<"....d="<<dist<<" x="<<x<<" y="<<y<<endl;
     193 cout<<"****** NON teste (CMV) ******"<<endl;
     194
     195 return dist;
     196}
Note: See TracChangeset for help on using the changeset viewer.