diff --git a/src/surface/sf_square.scad b/src/surface/sf_square.scad index f29ca47e..e2708e78 100644 --- a/src/surface/sf_square.scad +++ b/src/surface/sf_square.scad @@ -19,23 +19,21 @@ module sf_square(levels, thickness, depth, x_twist = 0, y_twist = 0, invert = fa surface = _sf_square_surfaces(levels, thickness, dp, invert); off = [0, 0, invert ? thickness : 0]; + xt = x_twist != 0; + yt = y_twist != 0; sf_solidify( [ for(row = surface[0]) [ for(p = row) - ptf_y_twist(size, - ptf_x_twist(size, p + off, x_twist), - y_twist - ) + let(p_off = p + off, p_xt = xt ? ptf_x_twist(size, p_off, x_twist) : p_off) + yt ? ptf_y_twist(size, p_xt, y_twist) : p_xt ] ], [ for(row = surface[1]) [ for(p = row) - ptf_y_twist(size, - ptf_x_twist(size, p, x_twist), - y_twist - ) + let(p_xt = xt ? ptf_x_twist(size, p, x_twist) : p) + yt ? ptf_y_twist(size, p_xt, y_twist) : p_xt ] ], convexity = convexity