aboutsummaryrefslogtreecommitdiff
path: root/src/path.h
blob: 2355021dc41b925a8b25b1073f8bf9a7e4ca360f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/// src/path.h
//
// Copyright (C) 2026 by Martin Michalec <martin@michalec.dev>
//
// SPDX-License-Identifier: MIT
//
/// Commentary:
//
/// Code:

#ifndef INCLUDED_PATH_H
#define INCLUDED_PATH_H

#include "utils.h"
#include "rs274ngc_cst.h"
#include "vec2.h"

#define PEF_TRAVERSING      (1 << 0) // 0 means technological
#define PEF_ARC             (1 << 1) // 0 means line
#define PEF_CCW             (1 << 2) // 0 means CW
#define PEF_RELATIVE        (1 << 3) // 0 means absolute
#define PEF_INCH            (1 << 4) // 0 means mm
// ...

struct path_element {
  struct sv line;
  double x, y;                  // end coords (abs mm)
  double f;                     // feed rate (mm/s)
  double i, j;                  // centers for arcs (abs mm)
  int flags;
};

struct path {
  struct path_element *items;
  uint32_t count;
  uint32_t capacity;
  double initial_x;
  double initial_y;
};

struct path build_path (struct rs274ngc_cst_parser parser);
struct vec2 path_element_start (const struct path *, const struct path_element *);

#endif // INCLUDED_PATH_H

/// src/path.h ends here