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 382 del file volume.h.

383  {
384  // Ensure that we have enough standard elevations
385  if (elevations.size() < this->size())
386  {
387  LOG_CATEGORY("radar.io");
388  LOG_ERROR("normalize_elevations: standard elevation array has %zd elements, but we have %zd scans",
389  elevations.size(), this->size());
390  throw std::runtime_error("not enough standard elevations");
391  }
392  // Ensure that the nudging that we do do not confuse a scan
393  // with another
394  for (size_t i = 0; i < this->size() - 1; ++i)
395  {
396  if (abs(elevations[i] - this->at(i).elevation) > abs(elevations[i] - this->at(i + 1).elevation))
397  {
398  LOG_CATEGORY("radar.io");
399  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);
400  throw std::runtime_error("real elevation is too different than standard elevations");
401  }
402  }
403  // Assign the new elevations
404  for (size_t i = 0; i < this->size(); ++i)
405  this->at(i).elevation = elevations[i];
406  }