Changeset 14238
- Timestamp:
- 01/11/13 14:16:33 (12 years ago)
- Location:
- issm/trunk-jpl/src/c/Container
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Container/DataSet.cpp
r13798 r14238 178 178 /*Check index in debugging mode*/ 179 179 _assert_(this!=NULL); 180 _assert_(offset>=0); 180 181 _assert_(offset<this->Size()); 181 182 -
issm/trunk-jpl/src/c/Container/Observations.cpp
r14226 r14238 129 129 Observation *observation = NULL; 130 130 131 /*If radius is not provided or is 0, return all observations*/ 131 /*First, find closest point in Quadtree (fast but might not be the true closest obs)*/ 132 this->quadtree->ClosestObs(&index,x_interp,y_interp); 133 _assert_(index>=0); 134 observation=dynamic_cast<Observation*>(this->GetObjectByOffset(index)); 135 hmin2 = (observation->x-x_interp)*(observation->x-x_interp) + (observation->y-y_interp)*(observation->y-y_interp); 136 137 /*Compute radius square*/ 132 138 if(radius==0) radius=this->quadtree->root->length; 133 134 /*Compute radius square*/135 139 radius2 = radius*radius; 140 if(hmin2<radius2){ 141 radius =sqrt(hmin2); 142 radius2=hmin2; 143 } 136 144 137 145 /*Find all observations that are in radius*/ … … 140 148 observation=dynamic_cast<Observation*>(this->GetObjectByOffset(indices[i])); 141 149 h2 = (observation->x-x_interp)*(observation->x-x_interp) + (observation->y-y_interp)*(observation->y-y_interp); 142 143 if(i==0){ 150 if(h2<hmin2){ 144 151 hmin2 = h2; 145 152 index = i; 146 }147 else{148 if(h2<hmin2){149 hmin2 = h2;150 index = i;151 }152 153 } 153 154 } … … 175 176 for(int i=0;i<n;i++){ 176 177 this->ClosestObservation(&xi,&yi,&obs,x[i],y[i],radius); 177 distances[i]=sqrt( (x[i]-xi)*(x[i]-xi) + (y[i]-yi)*(y[i]-yi) ); 178 if(xi==UNDEF && yi==UNDEF) 179 distances[i]=UNDEF; 180 else 181 distances[i]=sqrt( (x[i]-xi)*(x[i]-xi) + (y[i]-yi)*(y[i]-yi) ); 178 182 } 179 183 }/*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.