From 12a7c918f1a12e4d27a38146a91d4630e3019790 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sat, 9 Apr 2022 19:04:18 +0800 Subject: [PATCH] refactor: tail recursion --- src/_impl/_in_shape_impl.scad | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/_impl/_in_shape_impl.scad b/src/_impl/_in_shape_impl.scad index 96f2d6ee..a0076dc6 100644 --- a/src/_impl/_in_shape_impl.scad +++ b/src/_impl/_in_shape_impl.scad @@ -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); \ No newline at end of file