diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2025-11-20 22:31:53 +0100 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2025-11-20 22:31:53 +0100 |
| commit | acfa01613f6e7fbeace88a15df61252156d39cf1 (patch) | |
| tree | 9d81120f36c1cd74dfe5d2691ccf55c8707cd394 /inc/cad/topology.h | |
| parent | 6e4df49832827e21c6d62f722767664e5cb9d575 (diff) | |
Separate everything out
Diffstat (limited to 'inc/cad/topology.h')
| -rw-r--r-- | inc/cad/topology.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/inc/cad/topology.h b/inc/cad/topology.h new file mode 100644 index 0000000..b3879b2 --- /dev/null +++ b/inc/cad/topology.h @@ -0,0 +1,50 @@ +#pragma once + +#include <stddef.h> + +#define TOPO_MOVETO(c) \ + { .cmd = {TOPO_MOVETO} }, \ + { .arg = {c} } \ + +#define TOPO_LINETO(c) \ + { .cmd = {TOPO_LINETO} }, \ + { .arg = {c} } \ + +#define TOPO_ARCTO(center, end) \ + { .cmd = {TOPO_ARCTO} }, \ + { .arg = {center} }, \ + { .arg = {end} } \ + +#define TOPO_END() \ + { .cmd = {TOPO_END} } \ + +enum topology_op { + TOPO_MOVETO, + TOPO_LINETO, + TOPO_ARCTO, + + TOPO_END, +}; + +struct topology_cmd { + enum topology_op op; +}; + +struct topology_arg { + struct component *c; +}; + +struct topology_elem { + union { + struct topology_cmd cmd; + struct topology_arg arg; + }; +}; + +struct topology { + struct topology_elem *elements; + size_t length; + size_t capacity; +}; + +void add_fragment(struct topology *topo, struct topology_elem *new); |
