APL/APL1.2/FUn/flocon.c

72 lines
1.2 KiB
C
Raw Permalink Normal View History

2022-01-18 12:52:55 +01:00
#include <stdio.h>
#include <stdlib.h>
#include <graph.h>
#include <math.h>
#include <time.h>
#include "graph_sup.h"
struct vertex {
double x;
double y;
struct vertex* next;
};
typedef struct vertex vert;
typedef vert* poly;
double rad(double deg) {
return deg/180 * M_PI;
}
double a = 0.0;
poly makePoly(double x, double y, double r, double s) {
int max = 600;
double delta_ang = rad(360/(double)max);
vert* last_v = NULL;
vert* first_v = NULL;
for (int i = 0; i < s; i++) {
vert * v
}
first_v->next = last_v;
return last_v;
}
void drawPoly(poly tri) {
vert* start = tri;
int has_started = 0;
while (tri != start || has_started == 0) {
has_started = 1;
int x = tri->x;
int y = tri->y;
vert* next = tri->next;
int xx = next->x;
int yy = next->y;
tri = tri->next;
DessinerSegment(x, y, xx, yy);
}
}
int main(int argc, char * argv[]) {
InitialiserGraphique();
CreerFenetre(100, 100, 1920, 1080);
while (1) {
if (DrawNextFrame()) {
a += 0.01;
SetColor(255, 255, 255);
RemplirRectangle(0, 0, 1920, 1080);
SetColor(255, 0, 0);
poly pol = makePoly(1920/2, 1080/2, 400);
drawPoly(pol);
}
}
FermerGraphique();
return EXIT_SUCCESS;
}