Написал надёжный алгоритм поиска наименьшего круга

This commit is contained in:
AZEN-SGG 2024-12-10 07:01:19 +03:00
parent b36187b77d
commit b24722eefc
5 changed files with 90 additions and 6 deletions

View file

@ -1,5 +1,6 @@
#include "tools.h"
#include "SCP.h"
#include "hope.h"
int main(void) {
points ps;
@ -11,11 +12,19 @@ int main(void) {
ps = getPoints(file);
if (ps.array == NULL) return -2;
printf("\nPoints:\n");
for (int i = 0; i < ps.length; ++i) printf("(%.2lf, %.2lf) ", ps.array[i].x, ps.array[i].y);
printf("\n");
printf("\n\n");
printf("Fast algorithm:\n");
crcl = MEC(ps.array, ps.length, N, 0);
printCircle(crcl);
printf("\n");
printf("Reliable algorithm:\n");
crcl = hope(ps.array, ps.length);
printCircle(crcl);
free(ps.array);