1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-23 06:43:10 +02:00

add m_rotation

This commit is contained in:
Justin Lin
2019-04-28 15:40:42 +08:00
parent d6aae5fdf6
commit a8063a2be2

34
src/m_rotation.scad Normal file
View File

@@ -0,0 +1,34 @@
include <__private__/_m_multiply.scad>;
function _m_xRotation(a) =
let(c = cos(a), s = sin(a))
[
[1, 0, 0, 0],
[0, c, -s, 0],
[0, s, c, 0],
[0, 0, 0, 1]
];
function _m_yRotation(a) =
let(c = cos(a), s = sin(a))
[
[c, 0, s, 0],
[0, 1, 0, 0],
[-s, 0, c, 0],
[0, 0, 0, 1]
];
function _m_zRotation(a) =
let(c = cos(a), s = sin(a))
[
[c, -s, 0, 0],
[s, c, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]
];
function m_rotation(a) = _m_multiply(
_m_zRotation(a[2]), _m_multiply(
_m_yRotation(a[1]), _m_xRotation(a[0])
)
);