Elaboradar  0.1

◆ intersecting()

std::vector< pair< double, unsigned > > radarelab::algo::azimuthresample::AzimuthIndex::intersecting ( double  dst_azimuth,
double  dst_amplitude,
double  src_amplitude 
) const

Get all the positions intersecting an angle centered on azimuth and with the given amplitude.

Parametri
dst_azimuthcenter angle of the destination sector
dst_aplitudeamplitude in degrees of the destination sector
src_amplitudeamplitude in degrees of source beams

Definizione alla linea 67 del file azimuth_resample.cpp.

68 {
69  // Compute the amplitude between our beams assuming the angles we have are
70  // close to evenly spaced
71  double my_semi_amplitude = src_amplitude / 2.0;
72  // Angles closer than this amount are considered the same for overlap detection
73  static const double precision = 0.000000001;
74 
75  double lowest_azimuth = dst_azimuth - dst_amplitude / 2 - my_semi_amplitude + precision;
76  while (lowest_azimuth < 0) lowest_azimuth += 360;
77  lowest_azimuth = fmod(lowest_azimuth, 360);
78  double highest_azimuth = dst_azimuth + dst_amplitude / 2 + my_semi_amplitude - precision;
79  while (highest_azimuth < 0) highest_azimuth += 360;
80  highest_azimuth = fmod(highest_azimuth, 360);
81 
82  std::vector<pair<double, unsigned>> res;
83 
84  if (lowest_azimuth <= highest_azimuth)
85  {
86  auto begin = by_angle.lower_bound(lowest_azimuth);
87  auto end = by_angle.lower_bound(highest_azimuth);
88  for (auto i = begin; i != end; ++i)
89  res.push_back(*i);
90  } else {
91  auto begin = by_angle.upper_bound(lowest_azimuth);
92  auto end = by_angle.lower_bound(highest_azimuth);
93  for (auto i = begin; i != by_angle.end(); ++i)
94  res.push_back(*i);
95  for (auto i = by_angle.begin(); i != end; ++i)
96  res.push_back(*i);
97  }
98 
99  return res;
100 }
std::map< double, unsigned > by_angle
map azimuth angles to beam indices