1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-11 09:14:29 +02:00

always to a vect

This commit is contained in:
Justin Lin
2019-05-02 10:22:31 +08:00
parent 69f43afe46
commit f215f27f9f

View File

@@ -1,6 +1,15 @@
function m_translation(v) = [
[1, 0, 0, v[0]],
[0, 1, 0, v[1]],
[0, 0, 1, v[2]],
function _to_vect(v) =
len(v) == 3 ? v : (
len(v) == 2 ? [v[0], v[1], 0] : (
len(v) == 1 ? [v[0], 0, 0] : [v, 0, 0]
)
);
function m_translation(v) =
let(vt = _to_vect(v))
[
[1, 0, 0, vt[0]],
[0, 1, 0, vt[1]],
[0, 0, 1, vt[2]],
[0, 0, 0, 1]
];