Compare commits

..

2 Commits

Author SHA1 Message Date
William
aaba6c095e (MOD) Added new item into .gitignore 2024-05-24 23:50:01 +08:00
William
58bbfc54e8 (ADD) Point, Line, Rect 2024-05-24 23:49:17 +08:00
3 changed files with 51 additions and 1 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
vscGetReady.sh
*~
main
test.sh
main.c

View File

@@ -0,0 +1,45 @@
#ifndef CYBERSIGHT_GEOMETRY_H
# define CYBERSIGHT_GEOMETRY_H
# include <Compound/common.h>
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 */

View File

@@ -1,3 +1,3 @@
# CyberSight
Use your Cyber Sight for exploring computational universe.
Use your Cyber Sight for exploring computational universe.