mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-05 22:37:35 +02:00
behave as rotate
This commit is contained in:
@@ -35,5 +35,22 @@ function _rotz(pt, a) =
|
|||||||
pt[2]
|
pt[2]
|
||||||
];
|
];
|
||||||
|
|
||||||
function rotate_p(point, a) =
|
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 _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) =
|
||||||
|
let(angle = to_avect(a))
|
||||||
|
len(point) == 3 ?
|
||||||
|
_rotate_p_3d(point, angle) :
|
||||||
|
_to2d(
|
||||||
|
_rotate_p_3d([point[0], point[1], 0], angle)
|
||||||
|
);
|
||||||
|
Reference in New Issue
Block a user