Elaboradar 0.1
Caricamento in corso...
Ricerca in corso...
Nessun risultato

◆ closest()

pair< double, unsigned > radarelab::algo::azimuthresample::AzimuthIndex::closest ( double azimuth) const

Get the closest position to an azimuth angle.

Parametri
[in]azimuth- Searched value
Restituisce
pair value

Definizione alla linea 48 del file azimuth_resample.cpp.

49{
50 auto i = by_angle.lower_bound(azimuth);
51
52 // Result between the end and the beginning: assume it falls between
53 // first and last
54 if (i == by_angle.end() || i == by_angle.begin())
55 return closest_of_two(azimuth, *by_angle.rbegin(), *by_angle.begin());
56
57 // Exact match: return the Position
58 if (i->first == azimuth)
59 return *i;
60
61 // Return the closest between the previous element and this one
62 std::map<double, unsigned>::const_iterator prev = i;
63 --prev;
64 return closest_of_two(azimuth, *prev, *i);
65}
std::map< double, unsigned > by_angle
map azimuth angles to beam indices

Referenzia by_angle.