add bresenham line algo, lfutility and Point struct

This commit is contained in:
2022-03-30 14:35:23 -07:00
parent 8b2a459252
commit 238ce2c2d2
4 changed files with 57 additions and 2 deletions

View File

@ -1,6 +1,8 @@
#ifndef LIBFLINT_H_MATH
#define LIBFLINT_H_MATH
#include "lfutility.h"
int max_int(int a, int b);
int min_int(int a, int b);
@ -9,4 +11,8 @@ int clamp_int(int i, int low, int high);
int binstr_to_int(const char *s);
Point *bresenham(int x0, int y0, int x1, int y1, size_t *sz);
Point *bresenham_p(Point p1, Point p2, size_t *sz);
#endif // LIBFLINT_H_MATH

9
include/lfutility.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef LIBFLINT_H_UTILITY
#define LIBFLINT_H_UTILITY
typedef struct Point {
int x;
int y;
} Point;
#endif // LIBFLINT_H_UTILITY