summaryrefslogtreecommitdiff
path: root/c++/core/platonic.h
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2023-11-27 23:03:57 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2023-11-27 23:03:57 +0100
commitaa2ecacd2e477eb5748f060d33138e0c12c0634f (patch)
treed0360b420ecddaf6b9986c004ea3e0b962c9ca1b /c++/core/platonic.h
parent0cf04f2d1ba5ed2a18fe9f3501f363cb3ff76c9f (diff)
codec,core,tools: Adding dangling experimental changes
Diffstat (limited to 'c++/core/platonic.h')
-rw-r--r--c++/core/platonic.h103
1 files changed, 103 insertions, 0 deletions
diff --git a/c++/core/platonic.h b/c++/core/platonic.h
new file mode 100644
index 0000000..eefe99f
--- /dev/null
+++ b/c++/core/platonic.h
@@ -0,0 +1,103 @@
+#pragma once
+
+#include "error.h"
+
+namespace saw {
+namespace impl {
+/**
+ *
+ */
+template<typename Prec, uint8_t N>
+struct platonic_helper {
+ static_assert(always_false<Prec,N>, "Unsupported platonic body. Alternatively it's not a platonic body");
+};
+
+template<typename Prec>
+struct platonic_helper<Prec,4u> {
+ static constexpr surface_edges = 3u;
+/*
+ static constexpr std::array<std::array<Prec,3u>, 4u> normals = {
+ {0.0, 0.0, -1.0}, // 1
+ {}, // 2
+ {}, // 3
+ {} // 4
+ };
+*/
+};
+
+template<typename Prec>
+struct platonic_helper<Prec,6u> {
+ static constexpr surface_edges = 4u;
+
+ static constexpr std::array<std::array<Prec,3u>, 6u> normals = {
+ { 1.0, 0.0, 0.0}, // 1
+ {-1.0, 0.0, 0.0}, // 2
+ { 0.0, 1.0, 0.0}, // 3
+ { 0.0,-1.0, 0.0}, // 4
+ { 0.0, 0.0, 1.0}, // 5
+ { 0.0, 0.0,-1.0} // 6
+ };
+};
+
+template<typename Prec>
+struct platonic_helper<Prec,20u> {
+ static constexpr uint8_t surface_edges = 3u;
+/*
+ static constexpr std::array<std::array<Prec,3u>, 20u> normals = {
+ {}, // 1
+ {}, // 2
+ {}, // 3
+ {}, // 4
+ {}, // 5
+ {}, // 6
+ {}, // 7
+ {}, // 8
+ {}, // 9
+ {}, // 10
+ {}, // 11
+ {}, // 12
+ {}, // 13
+ {}, // 14
+ {}, // 15
+ {}, // 16
+ {}, // 17
+ {}, // 18
+ {}, // 19
+ {} // 20
+ };
+*/
+};
+}
+/**
+ * Container for describing each platonic body with
+ * helpers describing the orientation of each body.
+ */
+template<typename T, typename Prec, uint8_t N>
+class platonic {
+private:
+ /**
+ * Storage for the surfaces
+ */
+ std::array<T,N> surfaces_;
+public:
+ constexpr uint8_t get_surface_edge_size() constexpr {
+ return platonic_helper<T,N>::surface_edges;
+ }
+
+ constexpr uint8_t get_surface_size() constexpr {
+ return N;
+ }
+
+ T& at(uint8_t i){
+ return surface_.at(i);
+ }
+
+ const T& at(uint8_t i) const {
+ return surface_.at(i);
+ }
+
+ constexpr std::array<Prec, 3>& get_surface_normal(size_t i) constexpr {
+
+ }
+};
+}