Написал 10ю задачу по Геометрии

This commit is contained in:
AZEN-SGG 2024-12-15 13:42:03 +03:00
parent 19e0da8dc6
commit 241b43fa19
20 changed files with 432 additions and 0 deletions

View file

@ -0,0 +1,40 @@
#include "tools.h"
#include "polygon.h"
int main(void) {
points ps;
double shift;
polygon plgn, new_polygon;
FILE * file = getFile();
if (file == NULL) return -1;
ps = getPoints(file);
if (ps.arr == NULL) return -2;
if (ps.len < 3) {
printf("Incorrect polygon!\n");
return -4;
}
shift = getShift();
if (-eps < shift && shift < eps) return -3;
plgn.pts = ps;
repairPolygon(&plgn);
if (plgn.pts.len <= 1) {
printf("Incorrect polygon!\n");
return -4;
}
printPolygon(plgn, "\nOriginal polygon:\n");
new_polygon = getPolygon(&plgn, shift);
printPolygon(new_polygon, "\n\nNew polygon:\n");
free(ps.arr);
free(new_polygon.pts.arr);
return 0;
}