src/particle_filter.cpp
void ParticleFilter::dataAssociation(vector<LandmarkObs> predicted, vector<LandmarkObs>& observations) {

  double closest;
  double distance;
  
  for (LandmarkObs &observation: observations) {
    closest = std::numeric_limits<double>::max();
    
    for (const LandmarkObs &prediction: predicted) { 
      distance = dist(observation.x, observation.y, prediction.x, prediction.y);
      
      if(distance < closest) {
      	closest = distance;
        observation.id = prediction.id;
      }
    }
  }
}
/**
 * @brief foreach observation find the prediction thatis the most probably match due to being in proximity.
 * 
 * @param predicted 
 * @param observations 
 */
@brief foreach observation find the prediction thatis the most probably match due to being in proximity.

@param predicted
@param observations
@brief foreach observation find the prediction thatis the most probably match due to being in proximity . @param predicted @param observations
void ParticleFilter::dataAssociation(vector<LandmarkObs> predicted, vector<LandmarkObs>& observations) {
  double closest;
  double distance;
  for (LandmarkObs &observation: observations) {
    closest = std::numeric_limits<double>::max();
    for (const LandmarkObs &prediction: predicted) { 
      distance = dist(observation.x, observation.y, prediction.x, prediction.y);
      if(distance < closest) {
      	closest = distance;
        observation.id = prediction.id;
      }
    }
  }
}
void ParticleFilter :: dataAssociation ( vector < LandmarkObs > predicted , vector < LandmarkObs > & observations ) { double closest ; double distance ; for ( LandmarkObs & observation : observations ) { closest = std :: numeric_limits < double > :: max ( ) ; for ( const LandmarkObs & prediction : predicted ) { distance = dist ( observation . x , observation . y , prediction . x , prediction . y ) ; if ( distance < closest ) { closest = distance ; observation . id = prediction . id ; } } } }
@brief foreach observation find the prediction thatis the most probably match due to being in proximity.
@brief foreach observation find the prediction thatis the most probably match due to being in proximity .