1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-18 12:31:17 +02:00

check vector

This commit is contained in:
Justin Lin
2019-05-15 09:26:58 +08:00
parent 665fb09864
commit b3ffb9ab72

View File

@@ -10,6 +10,7 @@
include <__private__/__to2d.scad>; include <__private__/__to2d.scad>;
include <__private__/__to3d.scad>; include <__private__/__to3d.scad>;
include <__private__/__is_vector.scad>;
function _q_rotate_p_3d(p, a, v) = function _q_rotate_p_3d(p, a, v) =
@@ -70,14 +71,13 @@ function _rotate_p_3d(point, a) =
_rotz(_roty(_rotx(point, a[0]), a[1]), a[2]); _rotz(_roty(_rotx(point, a[0]), a[1]), a[2]);
function _to_avect(a) = function _to_avect(a) =
len(a) == 3 ? a : ( let(leng = len(a))
len(a) == 2 ? [a[0], a[1], 0] : ( leng == 3 ? a : (
len(a) == 1 ? [a[0], 0, 0] : [0, 0, a] leng == 2 ? [a[0], a[1], 0] : [a[0], 0, 0]
)
); );
function _rotate_p(p, a) = function _rotate_p(p, a) =
let(angle = _to_avect(a)) let(angle = __is_vector(a) ? _to_avect(a) : [0, 0, a])
len(p) == 3 ? len(p) == 3 ?
_rotate_p_3d(p, angle) : _rotate_p_3d(p, angle) :
__to2d( __to2d(