diff options
author | erdgeist <erdgeist@bauklotz.fritz.box> | 2017-04-08 14:21:36 +0200 |
---|---|---|
committer | erdgeist <erdgeist@bauklotz.fritz.box> | 2017-04-08 14:21:36 +0200 |
commit | f2683a4b707cd714b7f540ebf6482563df83d51e (patch) | |
tree | de4941add99f0eb1642aa57c6af180b4ee70119a /geometry.h | |
parent | 78d309a97b782bd6ab2716fa7595bb3f409479e3 (diff) |
Near complete rewrite.
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 | |||