1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-10 16:54:23 +02:00

refactor: tail recursion

This commit is contained in:
Justin Lin
2022-04-09 19:04:18 +08:00
parent 7af202f5e5
commit 12a7c918f1

View File

@@ -29,9 +29,5 @@ function _in_shape_does_pt_cross(pts, i, j, pt) =
function _in_shape_sub(shapt_pts, leng, pt, cond, i, j) =
j == leng ? cond : (
_in_shape_does_pt_cross(shapt_pts, i, j, pt) ?
_in_shape_sub(shapt_pts, leng, pt, !cond, j, j + 1) :
_in_shape_sub(shapt_pts, leng, pt, cond, j, j + 1)
);
j == leng ? cond : _in_shape_sub(shapt_pts, leng, pt, _in_shape_does_pt_cross(shapt_pts, i, j, pt) ? !cond : cond, j, j + 1);