From e3d4de3e1d5051e92f2ce72ee2521bb08375ac4b Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Tue, 7 Mar 2023 13:07:21 -0800 Subject: [PATCH 1/3] Added point attachment geometry. --- attachments.scad | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/attachments.scad b/attachments.scad index 18a1d8f..3989124 100644 --- a/attachments.scad +++ b/attachments.scad @@ -2080,6 +2080,8 @@ function named_anchor(name, pos, orient=UP, spin=0) = [name, pos, orient, spin]; // Function: attach_geom() // +// Usage: Null/Point Geometry +// geom = attach_geom(...); // Usage: Square/Trapezoid Geometry // geom = attach_geom(two_d=true, size=, [size2=], [shift=], ...); // Usage: Circle/Oval Geometry @@ -2129,6 +2131,9 @@ function named_anchor(name, pos, orient=UP, spin=0) = [name, pos, orient, spin]; // two_d = If true, the attachable shape is 2D. If false, 3D. Default: false (3D) // axis = The vector pointing along the axis of a geometry. Default: UP // +// Example(NORENDER): Null/Point Shape +// geom = attach_geom(); +// // Example(NORENDER): Cubical Shape // geom = attach_geom(size=size); // @@ -2281,7 +2286,7 @@ function attach_geom( ) ) ) : - assert(false, "Unrecognizable geometry description."); + ["point", cp, offset, anchors]; @@ -2315,6 +2320,7 @@ function _attach_geom_2d(geom) = // Returns the `[X,Y,Z]` bounding size for the given attachment geometry description. function _attach_geom_size(geom) = let( type = geom[0] ) + type == "point"? [0,0,0] : type == "prismoid"? ( //size, size2, shift, axis let( size=geom[1], size2=geom[2], shift=point2d(geom[3]), @@ -2555,6 +2561,12 @@ function _find_anchor(anchor, geom) = pos2 = rot(from=UP, to=axis, p=pos), vec2 = anch==CENTER? UP : rot(from=UP, to=axis, p=vec) ) [anchor, pos2, vec2, oang] + ) : type == "point"? ( + let( + anchor = unit(point3d(anchor),CENTER), + pos = point3d(cp) + point3d(offset), + vec = unit(anchor,UP) + ) [anchor, pos, vec, oang] ) : type == "spheroid"? ( //r let( rr = geom[1], From 2d1f2b4384a1d7478864e1b0e31da6b1373272c1 Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Wed, 8 Mar 2023 04:55:37 -0800 Subject: [PATCH 2/3] Fix for Issue #1010: rotate_sweep with texture VNF produces reversed faces and reversed texture --- skin.scad | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/skin.scad b/skin.scad index 5bad4e5..e114cd8 100644 --- a/skin.scad +++ b/skin.scad @@ -3685,8 +3685,12 @@ function _textured_revolution( assert(in_list(atype, _ANCHOR_TYPES), "Anchor type must be \"hull\" or \"intersect\"") let( regions = !is_path(shape,2)? region_parts(shape) : - shape[0].y <= last(shape).y? [[reverse(shape)]] : - [[shape]], + closed? region_parts([shape]) : + region_parts([ + [0,shape[0].y], + each shape, + [0,last(shape).y], + ]), checks = [ for (rgn=regions, path=rgn) assert(all(path, function(pt) pt.x>=0)) @@ -3747,7 +3751,7 @@ function _textured_revolution( is_path(taper,2)? let( retaper = [ for (t=taper) - assert(t[0]>=0 && t[0]<=100, "taper lookup indices must be betweem 0 and 100 inclusive.") + assert(t[0]>=0 && t[0]<=100, "taper lookup indices must be between 0 and 100 inclusive.") [t[0]/100, t[1]] ], taperout = [[-1,retaper[0][1]], each retaper, [2,last(retaper)[1]]] From e4d864b0ad6e91fdc2c01a0e07939faccd817016 Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Wed, 8 Mar 2023 05:43:54 -0800 Subject: [PATCH 3/3] Fixed taper broken by fix for #1010 --- skin.scad | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/skin.scad b/skin.scad index e114cd8..343d168 100644 --- a/skin.scad +++ b/skin.scad @@ -3686,11 +3686,12 @@ function _textured_revolution( let( regions = !is_path(shape,2)? region_parts(shape) : closed? region_parts([shape]) : - region_parts([ - [0,shape[0].y], - each shape, - [0,last(shape).y], - ]), + let( + clpoly = [[0,shape[0].y], each shape, [0,last(shape).y]], + dpoly = deduplicate(clpoly), + cwpoly = is_polygon_clockwise(dpoly) ? dpoly : reverse(dpoly) + ) + [[ select(cwpoly,1,-2) ]], checks = [ for (rgn=regions, path=rgn) assert(all(path, function(pt) pt.x>=0))