summaryrefslogtreecommitdiff
path: root/meme/mesh.h
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2014-09-12 02:54:30 (GMT)
committerWerner Almesberger <werner@almesberger.net>2014-09-12 03:13:49 (GMT)
commit2bc5b2f3ab23a4f75bbb8c23cf437519bb332808 (patch)
treeae092628f305c449572ce3f5304e6b3164e77e68 /meme/mesh.h
parente41c8e654bbe68360aec22b35b424a8849947a98 (diff)
downloadmisc-2bc5b2f3ab23a4f75bbb8c23cf437519bb332808.zip
misc-2bc5b2f3ab23a4f75bbb8c23cf437519bb332808.tar.gz
misc-2bc5b2f3ab23a4f75bbb8c23cf437519bb332808.tar.bz2
measmesh/: renamed to meme/
Too much typing ;-)
Diffstat (limited to 'meme/mesh.h')
-rw-r--r--meme/mesh.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/meme/mesh.h b/meme/mesh.h
new file mode 100644
index 0000000..1927147
--- /dev/null
+++ b/meme/mesh.h
@@ -0,0 +1,54 @@
+/*
+ * mesh.h - 3D mesh data structures
+ *
+ * Written 2014 by Werner Almesberger
+ * Copyright 2014 by Werner Almesberger
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+
+#ifndef MESH_H
+#define MESH_H
+
+
+#include <stdbool.h>
+
+
+struct vertex {
+ int x, y, z;
+};
+
+
+struct edge {
+ const struct vertex *a, *b;
+ bool drawn;
+ struct edge *next;
+};
+
+
+struct facet {
+ const struct vertex *v[3];
+ struct facet *next;
+};
+
+
+extern struct edge *edges;
+extern struct facet *facets;
+
+
+const struct vertex *vertex_add(int x, int y, int z);
+
+void vertex_foreach(bool (*fn)(struct vertex *v, void *user), void *user);
+void vertex_foreach_const(bool (*fn)(const struct vertex *v, void *user),
+ void *user);
+
+const struct facet *facet_add(const struct vertex *a, const struct vertex *b,
+ const struct vertex *c);
+
+void mesh_init(void);
+
+#endif /* !MESH_H */