mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-11 09:14:29 +02:00
refactor: tail recursion
This commit is contained in:
@@ -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) =
|
function _in_shape_sub(shapt_pts, leng, pt, cond, i, j) =
|
||||||
j == leng ? cond : (
|
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);
|
||||||
_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)
|
|
||||||
);
|
|
||||||
|
|
Reference in New Issue
Block a user