summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-06 13:03:42 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-06 13:03:42 +0000
commitdcef947ea986f4ad4633189652abccebdd7aa3f6 (patch)
tree7d07de0389f3e7bf8653838bd5709fc9a0c66e58 /lib
parentSimplified RailVehicle::intersectRay (diff)
downloadilt-dcef947ea986f4ad4633189652abccebdd7aa3f6.tar.bz2
ilt-dcef947ea986f4ad4633189652abccebdd7aa3f6.tar.xz
ilt-dcef947ea986f4ad4633189652abccebdd7aa3f6.zip
Helper to create a cubiod from dimensions
Diffstat (limited to 'lib')
-rw-r--r--lib/basicShapes.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/basicShapes.h b/lib/basicShapes.h
new file mode 100644
index 0000000..183863e
--- /dev/null
+++ b/lib/basicShapes.h
@@ -0,0 +1,19 @@
+#pragma once
+#include <array>
+#include <glm/vec3.hpp>
+
+template<typename T, glm::qualifier Q = glm::defaultp>
+constexpr std::array<glm::vec<3, T, Q>, 8>
+cuboidCorners(T lx, T ux, T ly, T uy, T lz, T uz)
+{
+ return {{
+ {lx, uy, lz}, // LFB
+ {ux, uy, lz}, // RFB
+ {lx, uy, uz}, // LFT
+ {ux, uy, uz}, // RFT
+ {lx, ly, lz}, // LBB
+ {ux, ly, lz}, // RBB
+ {lx, ly, uz}, // LBT
+ {ux, ly, uz}, // RBT
+ }};
+}