aboutsummaryrefslogtreecommitdiff
path: root/src/vec4ops/rotations4d.cpp
diff options
context:
space:
mode:
authorDavid Doan <daviddoan@Davids-MacBook-Pro-100.local>2023-12-08 15:04:43 -0500
committerDavid Doan <daviddoan@Davids-MacBook-Pro-100.local>2023-12-08 15:04:43 -0500
commit87be193a27a4d6ab583982e6d22eaccf154fff34 (patch)
tree4db10fc80f9077db4aab78ebd288b36ef4ca9368 /src/vec4ops/rotations4d.cpp
parenta44bcf18656062785c89e8fde25c232431b0d585 (diff)
parent480c22ce9b50caad259e254d0127e99294b4c6ab (diff)
merge
Diffstat (limited to 'src/vec4ops/rotations4d.cpp')
-rw-r--r--src/vec4ops/rotations4d.cpp74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/vec4ops/rotations4d.cpp b/src/vec4ops/rotations4d.cpp
new file mode 100644
index 0000000..4943c7f
--- /dev/null
+++ b/src/vec4ops/rotations4d.cpp
@@ -0,0 +1,74 @@
+#include "raytracer/raytracer.h"
+#include "4dvecops/vec4ops.h"
+
+glm::mat4 Vec4Ops::getRotationMatrix4XY(
+ float angleRadians) {
+ glm::mat4 result;
+ result[0][0] = cos(angleRadians);
+ result[0][1] = -sin(angleRadians);
+ result[1][0] = sin(angleRadians);
+ result[1][1] = cos(angleRadians);
+ result[2][2] = 1;
+ result[3][3] = 1;
+ return result;
+}
+
+glm::mat4 Vec4Ops::getRotationMatrix4YZ(
+ float angleRadians) {
+ glm::mat4 result;
+ result[1][1] = cos(angleRadians);
+ result[1][2] = -sin(angleRadians);
+ result[2][1] = sin(angleRadians);
+ result[2][2] = cos(angleRadians);
+ result[0][0] = 1;
+ result[3][3] = 1;
+ return result;
+}
+
+glm::mat4 Vec4Ops::getRotationMatrix4ZX(
+ float angleRadians) {
+ glm::mat4 result;
+ result[2][2] = cos(angleRadians);
+ result[2][0] = -sin(angleRadians);
+ result[0][2] = sin(angleRadians);
+ result[0][0] = cos(angleRadians);
+ result[1][1] = 1;
+ result[3][3] = 1;
+ return result;
+}
+
+glm::mat4 Vec4Ops::getRotationMatrix4XW(
+ float angleRadians) {
+ glm::mat4 result;
+ result[0][0] = cos(angleRadians);
+ result[0][3] = -sin(angleRadians);
+ result[3][0] = sin(angleRadians);
+ result[3][3] = cos(angleRadians);
+ result[1][1] = 1;
+ result[2][2] = 1;
+ return result;
+}
+
+glm::mat4 Vec4Ops::getRotationMatrix4YW(
+ float angleRadians) {
+ glm::mat4 result;
+ result[1][1] = cos(angleRadians);
+ result[1][3] = -sin(angleRadians);
+ result[3][1] = sin(angleRadians);
+ result[3][3] = cos(angleRadians);
+ result[0][0] = 1;
+ result[2][2] = 1;
+ return result;
+}
+
+glm::mat4 Vec4Ops::getRotationMatrix4ZW(
+ float angleRadians) {
+ glm::mat4 result;
+ result[2][2] = cos(angleRadians);
+ result[2][3] = -sin(angleRadians);
+ result[3][2] = sin(angleRadians);
+ result[3][3] = cos(angleRadians);
+ result[0][0] = 1;
+ result[1][1] = 1;
+ return result;
+} \ No newline at end of file