#include "radar.h"
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

double compute_distance(struct point a, struct point b){
   
    return sqrt( pow((b.x - a.x),2) + pow((b.y - a.y),2) );
}

int is_in_area(struct point center, double radius, struct point point){

    int rslt = compute_distance(center, point);

    if(rslt > radius) return 0;
    return 1;
}

size_t detect_points(struct point center, double range, struct point *interesting_points, size_t nb_points){

    size_t found = 0;
    for(size_t i = 0; i < nb_points; i++){

        if(is_in_area(center, range,interesting_points[i]) == 1){ 
            printf("{ %f, %f }\n",interesting_points[i].x, interesting_points[i].y);
            found ++;
        }
    }
    return found;
}
