Here I have a function in my code that checks the separation of aircraft when called and returns either no separation issues if the predicted paths of all other aircraft (stored in an expandable array) does not intersect with the minimum distance circle around the current one when comparing their relative position and velocity. it doesn't work though and I'm really confused as to what is wrong. I can send the rest of the code through if required void check_separation(ADSBPacket *plane, int planes_info) { int num = -1; for(int i = 0; i < planes_info; i++) { if(plane[planes_info].id == plane[i].id) { num = i; break; } } int original_time = (plane[num].hours * 3600) + (plane[num].minutes * 60); int new_time = (plane[planes_info].hours * 3600) + (plane[planes_info].minutes * 60); int time_change = new_time - original_time; double distance = plane[num].speed * time_change / 1000; double angle = plane[num].heading * M_PI / 180; double east_change = distance * cos(angle); double north_change = distance * sin(angle); plane[planes_info].north = plane[num].north + north_change; plane[planes_info].east = plane[num].east + east_change; plane[planes_info].heading = plane[num].heading; for(int i = 0; i < planes_info; i++) { int original_time = (plane[num].hours * 3600) + (plane[num].minutes * 60); int new_time = (plane[planes_info].hours * 3600) + (plane[planes_info].minutes * 60); int time_change = new_time - original_time; double distance = plane[i].speed * time_change / 1000; double angle = plane[i].heading * M_PI / 180; double east_change = distance * cos(angle); double north_change = distance * sin(angle); plane[planes_info].north = plane[i].north + north_change; plane[planes_info].east = plane[i].east + east_change; plane[planes_info].heading = plane[num].heading; double delta_p_north = plane[planes_info].north - plane[num].north; double delta_p_east = plane[planes_info].east - plane[num].east; double delta_v_north = (plane[planes_info].speed * sin(plane[i].heading)) - (plane[num].speed * sin(plane[i].heading)); double delta_v_east = (plane[planes_info].speed * cos(plane[i].heading)) - (plane[num].speed * cos(plane[i].heading)); double a = (delta_v_east * delta_v_east) + (delta_v_north * delta_v_north); double b = 2 * ((delta_v_north * delta_p_north) + (delta_v_east * delta_p_east)); double separation = 100; double c = (delta_p_north * delta_p_north) + (delta_p_east + delta_p_east) - (separation * separation); if((b * b)- (4 * a * c) >= 0) { printf("Separation issue\n"); break; } } printf("No separation issues\n"); }.