diff --git a/src/_impl/_archimedean_spiral_impl.scad b/src/_impl/_archimedean_spiral_impl.scad index fabfb6f8..36c2cad7 100644 --- a/src/_impl/_archimedean_spiral_impl.scad +++ b/src/_impl/_archimedean_spiral_impl.scad @@ -1,9 +1,9 @@ function _radian_step(b, theta, l) = let( - r_square = pow(b * theta, 2), + r_square = (b * theta) ^ 2, double_r_square = 2 * r_square ) - acos((double_r_square - pow(l, 2)) / double_r_square) / 180 * PI; + acos((double_r_square - l ^ 2) / double_r_square) / 180 * PI; function _find_radians(b, point_distance, radians, n, count = 1) = let(pre_radians = radians[count - 1]) @@ -21,5 +21,5 @@ function _archimedean_spiral_impl(arm_distance, init_angle, point_distance, num_ [ for(theta = _find_radians(b, point_distance, [init_radian], num_of_points)) let(r = b * theta, a = (rt_dir == "CT_CLK" ? 1 : -1) * theta * 57.2958) - [[r * cos(a), r * sin(a)], a] + [r * [cos(a), sin(a)], a] ]; \ No newline at end of file diff --git a/src/_impl/_bezier_curve_impl.scad b/src/_impl/_bezier_curve_impl.scad index 7a690fb1..25c2ed3c 100644 --- a/src/_impl/_bezier_curve_impl.scad +++ b/src/_impl/_bezier_curve_impl.scad @@ -7,7 +7,7 @@ function _combi(n, k) = [1,3,3,1] // n = 3: for Cubic Bézier curves ] ) - n < len(bi_coef) ? bi_coef[n][k] : ( + n < 4 ? bi_coef[n][k] : ( k == 0 ? 1 : (_combi(n, k - 1) * (n - k + 1) / k) ); @@ -21,12 +21,12 @@ function _bezier_curve_point2(t, points) = [ bezier_curve_coordinate( t, - [for(p = points) p[0]], + [for(p = points) p.x], n ), bezier_curve_coordinate( t, - [for(p = points) p[1]], + [for(p = points) p.y], n ) ]; @@ -36,17 +36,17 @@ function _bezier_curve_point3(t, points) = [ bezier_curve_coordinate( t, - [for(p = points) p[0]], + [for(p = points) p.x], n ), bezier_curve_coordinate( t, - [for(p = points) p[1]], + [for(p = points) p.y], n ), bezier_curve_coordinate( t, - [for(p = points) p[2]], + [for(p = points) p.z], n ) ]; diff --git a/src/_impl/_contours_impl.scad b/src/_impl/_contours_impl.scad index 84eb0c95..820ee936 100644 --- a/src/_impl/_contours_impl.scad +++ b/src/_impl/_contours_impl.scad @@ -21,7 +21,7 @@ function interpolated_pt(p0, p1, threshold) = function _isolines_pn_label(pts, threshold) = [ for(row = pts) - [for(p = row) [p.x, p.y, p.z, p.z >= threshold]] + [for(p = row) [each p, p.z >= threshold]] ]; function _isolines_corner_value(cell_pts) = @@ -116,10 +116,7 @@ function _isolines_of(cell_pts, threshold) = function _marching_squares_isolines(points, threshold) = let(labeled_pts = _isolines_pn_label(points, threshold)) [ - for( - y = [0:len(labeled_pts) - 2], - x = [0:len(labeled_pts[0]) - 2] - ) + for(y = [0:len(labeled_pts) - 2], x = [0:len(labeled_pts[0]) - 2]) let( p0 = labeled_pts[y][x], p1 = labeled_pts[y + 1][x], @@ -145,11 +142,12 @@ function _isobands_tri_label(pts, lower, upper) = for(row = pts) [ for(p = row) - let(label = - p[2] < lower ? "0" : - p[2] >= lower && p[2] <= upper ? "1" : "2" + let( + z = p.z, + label = z < lower ? "0" : + z >= lower && z <= upper ? "1" : "2" ) - [p[0], p[1], p[2], label] + [each p, label] ] ]; @@ -1393,10 +1391,7 @@ function _isobands_of(cell_pts, lower, upper) = function _marching_squares_isobands(points, lower, upper) = let(labeled_pts = _isobands_tri_label(points, lower, upper)) [ - for( - y = [0:len(labeled_pts) - 2], - x = [0:len(labeled_pts[0]) - 2] - ) + for(y = [0:len(labeled_pts) - 2], x = [0:len(labeled_pts[0]) - 2]) let( p0 = labeled_pts[y][x], p1 = labeled_pts[y + 1][x],