summaryrefslogtreecommitdiff
path: root/geometry.h
blob: 509ec7e3be320a8d7ff7c457512c37e8e0c7bc51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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);