From f2683a4b707cd714b7f540ebf6482563df83d51e Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 8 Apr 2017 14:21:36 +0200 Subject: Near complete rewrite. --- geometry.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 geometry.h (limited to 'geometry.h') diff --git a/geometry.h b/geometry.h new file mode 100644 index 0000000..509ec7e --- /dev/null +++ b/geometry.h @@ -0,0 +1,18 @@ +#pragma once + +typedef struct { + int x; + int y; +} LPoint; + +typedef struct { + LPoint p0; + LPoint p1; +} LLine; + +// dist is a fixed point with precission of 8 bits +// offs is where on the line segment xy0-xy1 the point's normale hits, +// range 0..65536 (but can extend, if normale hits line outside line segment) +int dist_pl(LPoint const * p, LLine const * l, int * offs); +int dist_pp(LPoint const * p0, LPoint const * p1); + -- cgit v1.2.3