diff options
Diffstat (limited to 'src/vec4ops/rotations4d.cpp')
-rw-r--r-- | src/vec4ops/rotations4d.cpp | 74 |
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 |