1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-02-25 01:53:12 +01:00
This commit is contained in:
Justin Lin 2020-01-27 08:24:44 +08:00
parent 8fcabc6d4d
commit f92bb8788e
2 changed files with 18 additions and 15 deletions

View File

@ -0,0 +1,16 @@
function _to_3_elems_translation_vect(v) =
let(leng = len(v))
leng == 3 ? v : (
leng == 2 ? [v[0], v[1], 0] : [v[0], 0, 0]
);
function _to_translation_vect(v) = is_num(v) ? [v, 0, 0] : _to_3_elems_translation_vect(v);
function _m_translation_impl(v) =
let(vt = _to_translation_vect(v))
[
[1, 0, 0, vt[0]],
[0, 1, 0, vt[1]],
[0, 0, 1, vt[2]],
[0, 0, 0, 1]
];

View File

@ -8,19 +8,6 @@
*
**/
function _to_3_elems_translation_vect(v) =
let(leng = len(v))
leng == 3 ? v : (
leng == 2 ? [v[0], v[1], 0] : [v[0], 0, 0]
);
use <matrix/_impl/_m_translation_impl.scad>;
function _to_translation_vect(v) = is_num(v) ? [v, 0, 0] : _to_3_elems_translation_vect(v);
function m_translation(v) =
let(vt = _to_translation_vect(v))
[
[1, 0, 0, vt[0]],
[0, 1, 0, vt[1]],
[0, 0, 1, vt[2]],
[0, 0, 0, 1]
];
function m_translation(v) = _m_translation_impl(v);