mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-04-20 22:21:52 +02:00
behave as rotate
This commit is contained in:
parent
252656eb73
commit
60235c44d3
@ -35,5 +35,22 @@ function _rotz(pt, a) =
|
||||
pt[2]
|
||||
];
|
||||
|
||||
function _rotate_p_3d(point, a) =
|
||||
_rotz(_roty(_rotx(point, a[0]), a[1]), a[2]);
|
||||
|
||||
function _to2d(p) = [p[0], p[1]];
|
||||
|
||||
function to_avect(a) =
|
||||
len(a) == 3 ? a : (
|
||||
len(a) == 2 ? [a[0], a[1], 0] : (
|
||||
len(a) == 1 ? [a[0], 0, 0] : [0, 0, a]
|
||||
)
|
||||
);
|
||||
|
||||
function rotate_p(point, a) =
|
||||
_rotz(_roty(_rotx(point, a[0]), a[1]), a[2]);
|
||||
let(angle = to_avect(a))
|
||||
len(point) == 3 ?
|
||||
_rotate_p_3d(point, angle) :
|
||||
_to2d(
|
||||
_rotate_p_3d([point[0], point[1], 0], angle)
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user