diff options
Diffstat (limited to 'geometry.h')
-rw-r--r-- | geometry.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/geometry.h b/geometry.h new file mode 100644 index 0000000..509ec7e --- /dev/null +++ b/geometry.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #pragma once | ||
2 | |||
3 | typedef struct { | ||
4 | int x; | ||
5 | int y; | ||
6 | } LPoint; | ||
7 | |||
8 | typedef struct { | ||
9 | LPoint p0; | ||
10 | LPoint p1; | ||
11 | } LLine; | ||
12 | |||
13 | // dist is a fixed point with precission of 8 bits | ||
14 | // offs is where on the line segment xy0-xy1 the point's normale hits, | ||
15 | // range 0..65536 (but can extend, if normale hits line outside line segment) | ||
16 | int dist_pl(LPoint const * p, LLine const * l, int * offs); | ||
17 | int dist_pp(LPoint const * p0, LPoint const * p1); | ||
18 | |||