Changeset 17122 for trunk/Mars/mcore/Interpolator2D.h
- Timestamp:
- 09/06/13 20:30:34 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcore/Interpolator2D.h
r17121 r17122 17 17 #define FACT_Interpolator2D 18 18 19 #include <float.h> 19 20 #include <vector> 20 21 … … 173 174 for (auto ip=outputGrid.cbegin(); ip<outputGrid.cend(); ip++) 174 175 { 175 double mindd = FLT_MAX;176 double mindd = DBL_MAX; 176 177 177 178 auto mint = circles.cend(); … … 283 284 } 284 285 286 Interpolator2D(const std::vector<Interpolator2D::vec> &v) 287 { 288 SetInputGrid(v); 289 } 290 285 291 const std::vector<Interpolator2D::weight> getWeights() const { return weights; } 286 292 const std::vector<Interpolator2D::point> getInputGrid() const { return inputGrid; } … … 316 322 } 317 323 324 void SetInputGrid(const std::vector<Interpolator2D::vec> &v) 325 { 326 circles.clear(); 327 weights.clear(); 328 outputGrid.clear(); 329 330 inputGrid.clear(); 331 inputGrid.reserve(v.size()); 332 for (size_t i=0; i<v.size(); i++) 333 inputGrid.emplace_back(i, v[i].x, v[i].y); 334 335 CalculateGrid(); 336 } 337 318 338 // -------------------------------------------------------------------------- 319 339 // … … 349 369 } 350 370 371 bool SetOutputGrid(const std::vector<std::pair<double,double>> &v) 372 { 373 if (inputGrid.empty()) 374 return false; 375 376 weights.clear(); 377 378 outputGrid.clear(); 379 outputGrid.reserve(v.size()); 380 for (size_t i=0; i<v.size(); i++) 381 outputGrid.emplace_back(i, v[i].first, v[i].second); 382 383 return CalculateWeights(); 384 } 385 351 386 // -------------------------------------------------------------------------- 352 387 // … … 362 397 //! not match the size of the inputGrid, an empty vector is returned. 363 398 // 364 std::vector<double> Interpolate(const vector<double> &z) const399 std::vector<double> Interpolate(const std::vector<double> &z) const 365 400 { 366 401 if (z.size()!=inputGrid.size())
Note:
See TracChangeset
for help on using the changeset viewer.