diff --git a/skin.scad b/skin.scad index edf5d91..9f6a7f2 100644 --- a/skin.scad +++ b/skin.scad @@ -1832,13 +1832,14 @@ function path_sweep(shape, path, method="incremental", normal, closed, twist=0, spathfrac = scale_by_length ? path_length_fractions(path, closed) : [for(i=[0:1:len(path)]) i / (len(path)-(closed?0:1))], L = len(path), unscaled_transform_list = - method=="incremental" ? + method=="old_incremental" ? let(rotations = [for( i = 0, ynormal = normal - (normal * tangents[0])*tangents[0], rotation = frame_map(y=ynormal, z=tangents[0]) ; - i < len(tangents) + (closed?1:0) ; + i < len(tangents) + (closed?1:0) + ; rotation = iEPSILON) - ) - v - ], - crossnormal = closed ? crossnormal_mid : [crossnormal_mid[0], each crossnormal_mid, last(crossnormal_mid)] - ) - [for(i=[0:L-(closed?0:1)]) let( - rotation = frame_map(x=crossnormal[i%L], z=tangents[i%L]) - ) - translate(path[i%L])*rotation*zrot(-twist*tpathfrac[i]) - ] : method=="natural" ? // map x axis of shape to the path normal, which points in direction of curvature let (pathnormal = path_normals(path, tangents, closed)) assert(all_defined(pathnormal),"Natural normal vanishes on your curve, select a different method") @@ -3129,6 +3158,8 @@ function associate_vertices(polygons, split, curpoly=0) = // ); +function _tex_fn_default() = 16; + __vnf_no_n_mesg=" texture is a VNF so it does not accept n. Set sample rate for VNF textures using the tex_samples parameter to cyl(), linear_sweep() or rotate_sweep()."; function texture(tex, n, border, gap, roughness, inset) = @@ -3622,7 +3653,7 @@ function _textured_linear_sweep( let( caps = is_bool(caps) ? [caps,caps] : caps, regions = is_path(region,2)? [[region]] : region_parts(region), - tex = is_string(texture)? texture(texture) : texture, + tex = is_string(texture)? texture(texture,$fn=_tex_fn_default()) : texture, dummy = assert(is_undef(samples) || is_vnf(tex), "You gave the tex_samples argument with a heightfield texture, which is not permitted. Use the n= argument to texture() instead"), dummy2=is_bool(rot)?echo("boolean value for tex_rot is deprecated. Use a numerical angle, one of 0, 90, 180, or 270.")0:0, texture = !rot? tex : @@ -3870,7 +3901,7 @@ function _textured_revolution( counts, samples, style="min_edge", atype="intersect", anchor=CENTER, spin=0, orient=UP -) = +) = assert(angle>0 && angle<=360) assert(is_path(shape,[2]) || is_region(shape)) assert(is_undef(samples) || is_int(samples)) @@ -3897,7 +3928,7 @@ function _textured_revolution( ) assert(closed || is_path(shape,2)) let( - tex = is_string(texture)? texture(texture) : texture, + tex = is_string(texture)? texture(texture,$fn=_tex_fn_default()) : texture, dummy = assert(is_undef(samples) || is_vnf(tex), "You gave the tex_samples argument with a heightfield texture, which is not permitted. Use the n= argument to texture() instead"), dummy2=is_bool(rot)?echo("boolean value for tex_rot is deprecated. Use a numerical angle, one of 0, 90, 180, or 270.")0:0, texture = !rot? tex :