This commit is contained in:
2026-02-11 13:20:47 +01:00
commit d3645f663c
30 changed files with 403 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
#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;
}