#ifndef CYBERSIGHT_GEOMETRY_H # define CYBERSIGHT_GEOMETRY_H # include typedef struct { int x; int y; } Point; # define point(x, y) (Point){x, y} Point PointUtils_Arithmetic(Point *inst, Point *value); bool PointUtils_Duplicate(Point *inst, Point *store); bool PointUtils_Displacement(Point *inst, Point *value); bool PointUtils_Equal(Point *inst, Point *other); typedef struct { Point a; Point b; } Line; # define line(pa, pb) (Line){{pa.x, pa.y}, {pb.x, pb.y}} bool LineUtils_FromPoints(Line *inst, Point *pa, Point *pb); bool LineUtils_FromPointAndLength(Line *inst, Point *p, int len); Line LineUtils_Arithmetic(Line *inst, Line *value); bool LineUtils_Duplicate(Line *inst, Line *store); bool LineUtils_Displacement(Line *inst, Line *value); int LineUtils_CalcLength(Line *inst); bool LineUtils_Equal(Line *inst, Line *other); typedef struct { Point a; Point b; } Rect; # define rect(pa, pb) (Rect){{pa.x, pa.y}, {pb.x, pb.y}} bool RectUtils_FromPoints(Rect *inst, Point *pa, Point *pb); bool RectUtils_FromLines(Rect *inst, Line *la, Line *lb); bool RectUtils_FromDiagonal(Rect *inst, Line *diag); bool RectUtils_Equal(Rect *inst, Rect *other); #endif /* CYBERSIGHT_GEOMETRY_H */