Elaboradar  0.1
 Tutto Classi Namespace File Funzioni Variabili Tipi enumerati (enum) Gruppi
template<typename T>
void radarelab::volume::Scans< T >::normalize_elevations ( const std::vector< double > &  elevations)
inline

Change the elevations in the PolarScans to match the given elevation vector.

Parametri
[in]elevations- values to be used

Definizione alla linea 395 del file volume.h.

396  {
397  // Ensure that we have enough standard elevations
398  if (elevations.size() < this->size())
399  {
400  LOG_CATEGORY("radar.io");
401  LOG_ERROR("normalize_elevations: standard elevation array has %zd elements, but we have %zd scans",
402  elevations.size(), this->size());
403  throw std::runtime_error("not enough standard elevations");
404  }
405  // Ensure that the nudging that we do do not confuse a scan
406  // with another
407  for (size_t i = 0; i < this->size() - 1; ++i)
408  {
409  if (abs(elevations[i] - this->at(i).elevation) > abs(elevations[i] - this->at(i + 1).elevation))
410  {
411  LOG_CATEGORY("radar.io");
412  LOG_ERROR("normalize_elevations: elevation %zd (%f) should be set to %f but it would make it closer to the next elevation %f", i, this->at(i).elevation, elevations[i], this->at(i + 1).elevation);
413  throw std::runtime_error("real elevation is too different than standard elevations");
414  }
415  }
416  // Assign the new elevations
417  for (size_t i = 0; i < this->size(); ++i)
418  this->at(i).elevation = elevations[i];
419  }