From b518763d6f5e19da82518cd62a43a2d8666b8303 Mon Sep 17 00:00:00 2001 From: Garth Minette Date: Sun, 27 Dec 2020 21:48:16 -0800 Subject: [PATCH] Fixed shift handling for rect geometries. --- attachments.scad | 84 ++++++++++++++++++++++++------------------------ version.scad | 2 +- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/attachments.scad b/attachments.scad index 112f173..2c17410 100644 --- a/attachments.scad +++ b/attachments.scad @@ -91,7 +91,7 @@ $tags_hidden = []; // Function: anchorpt() // Usage: -// anchor(name, pos, [dir], [rot]) +// anchor(name, pos, , ) // Description: // Creates a anchor data structure. // Arguments: @@ -105,21 +105,21 @@ function anchorpt(name, pos=[0,0,0], orient=UP, spin=0) = [name, pos, orient, sp // Function: attach_geom() // // Usage: Square/Trapezoid Geometry -// geom = attach_geom(anchor, spin, [orient], two_d, size, [size2], [shift], [cp], [offset], [anchors]); +// geom = attach_geom(anchor, spin, two_d, size, , , , , ); // Usage: Circle/Oval Geometry -// geom = attach_geom(anchor, spin, [orient], two_d, r|d, [cp], [offset], [anchors]); +// geom = attach_geom(anchor, spin, two_d, r|d, , , ); // Usage: 2D Path/Polygon Geometry -// geom = attach_geom(anchor, spin, [orient], two_d, path, [extent], [cp], [offset], [anchors]); +// geom = attach_geom(anchor, spin, two_d, path, , , , ); // Usage: Cubical/Prismoidal Geometry -// geom = attach_geom(anchor, spin, [orient], size, [size2], [shift], [cp], [offset], [anchors]); +// geom = attach_geom(anchor, spin, , size, , , , , ); // Usage: Cylindrical Geometry -// geom = attach_geom(anchor, spin, [orient], r|d, l, [cp], [axis], [offset], [anchors]); +// geom = attach_geom(anchor, spin, , r|d, l, , , , ); // Usage: Conical Geometry -// geom = attach_geom(anchor, spin, [orient], r1|d1, r2|d2, l, [cp], [axis], [offset], [anchors]); +// geom = attach_geom(anchor, spin, , r1|d1, r2|d2, l, , , , ); // Usage: Spheroid/Ovoid Geometry -// geom = attach_geom(anchor, spin, [orient], r|d, [cp], [offset], [anchors]); +// geom = attach_geom(anchor, spin, , r|d, , , ); // Usage: VNF Geometry -// geom = attach_geom(anchor, spin, [orient], vnf, [extent], [cp], [offset], [anchors]); +// geom = attach_geom(anchor, spin, , vnf, , , , ); // // Description: // Given arguments that describe the geometry of an attachable object, returns the internal geometry description. @@ -332,8 +332,8 @@ function attach_geom_size(geom) = ) delt ) : type == "rect"? ( //size, size2 let( - size=geom[1], size2=geom[2], - maxx = max(size.x,size2) + size=geom[1], size2=geom[2], shift=geom[3], + maxx = max(size.x,size2+abs(shift)) ) [maxx, size.y] ) : type == "circle"? ( //r let( r=geom[1] ) @@ -349,7 +349,7 @@ function attach_geom_size(geom) = // Function: attach_transform() // Usage: -// mat = attach_transform(anchor=CENTER, spin=0, orient=UP, geom); +// mat = attach_transform(anchor, spin, orient, geom); // Description: // Returns the affine3d transformation matrix needed to `anchor`, `spin`, and `orient` // the given geometry `geom` shape into position. @@ -557,12 +557,12 @@ function find_anchor(anchor, geom) = mpt = approx(point2d(anchor),[0,0])? [maxx,0,0] : [maxx, avgy, avgz], pos = point3d(cp) + rot(from=RIGHT, to=anchor, p=mpt) ) [anchor, pos, anchor, oang] - ) : type == "rect"? ( //size, size2 + ) : type == "rect"? ( //size, size2, shift let( - size=geom[1], size2=geom[2], + size=geom[1], size2=geom[2], shift=geom[3], u = (anchor.y+1)/2, frpt = [size.x/2*anchor.x, -size.y/2], - bkpt = [size2/2*anchor.x, size.y/2], + bkpt = [size2/2*anchor.x+shift, size.y/2], pos = point2d(cp) + lerp(frpt, bkpt, u) + offset, vec = unit(rot(from=BACK, to=bkpt-frpt, p=anchor),[0,1]) ) [anchor, pos, vec, 0] @@ -629,21 +629,21 @@ function attachment_is_shown(tags) = // Function: reorient() // // Usage: Square/Trapezoid Geometry -// reorient(anchor, spin, [orient], two_d, size, [size2], [shift], [cp], [offset], [anchors], [p]); +// reorient(anchor, spin, , two_d, size, , , , , ,

); // Usage: Circle/Oval Geometry -// reorient(anchor, spin, [orient], two_d, r|d, [cp], [offset], [anchors], [p]); +// reorient(anchor, spin, , two_d, r|d, , , ,

); // Usage: 2D Path/Polygon Geometry -// reorient(anchor, spin, [orient], two_d, path, [extent], [cp], [offset], [anchors], [p]); +// reorient(anchor, spin, , two_d, path, , , , ,

); // Usage: Cubical/Prismoidal Geometry -// reorient(anchor, spin, [orient], size, [size2], [shift], [cp], [offset], [anchors], [p]); +// reorient(anchor, spin, , size, , , , , ,

); // Usage: Cylindrical Geometry -// reorient(anchor, spin, [orient], r|d, l, [offset], [axis], [cp], [anchors], [p]); +// reorient(anchor, spin, , r|d, l, , , , ,

); // Usage: Conical Geometry -// reorient(anchor, spin, [orient], r1|d1, r2|d2, l, [axis], [cp], [offset], [anchors], [p]); +// reorient(anchor, spin, , r1|d1, r2|d2, l, , , , ,

); // Usage: Spheroid/Ovoid Geometry -// reorient(anchor, spin, [orient], r|d, [cp], [offset], [anchors], [p]); +// reorient(anchor, spin, , r|d, , , ,

); // Usage: VNF Geometry -// reorient(anchor, spin, [orient], vnf, [extent], [cp], [offset], [anchors], [p]); +// reorient(anchor, spin, , vnf, , , , ,

); // // Description: // Given anchor, spin, orient, and general geometry info for a managed volume, this calculates @@ -723,21 +723,21 @@ function reorient( // Module: attachable() // // Usage: Square/Trapezoid Geometry -// attachable(anchor, spin, [orient], two_d, size, [size2], [shift], [cp], [offset], [anchors] ... +// attachable(anchor, spin, two_d, size, , , , , ... // Usage: Circle/Oval Geometry -// attachable(anchor, spin, [orient], two_d, r|d, [cp], [offset], [anchors]) ... +// attachable(anchor, spin, two_d, r|d, , , ) ... // Usage: 2D Path/Polygon Geometry -// attachable(anchor, spin, [orient], two_d, path, [extent], [cp], [offset], [anchors] ... +// attachable(anchor, spin, two_d, path, , , , ... // Usage: Cubical/Prismoidal Geometry -// attachable(anchor, spin, [orient], size, [size2], [shift], [cp], [offset], [anchors] ... +// attachable(anchor, spin, , size, , , , , ... // Usage: Cylindrical Geometry -// attachable(anchor, spin, [orient], r|d, l, [axis], [cp], [offset], [anchors]) ... +// attachable(anchor, spin, , r|d, l, , , , ) ... // Usage: Conical Geometry -// attachable(anchor, spin, [orient], r1|d1, r2|d2, l, [axis], [cp], [offset], [anchors]) ... +// attachable(anchor, spin, , r1|d1, r2|d2, l, , , , ) ... // Usage: Spheroid/Ovoid Geometry -// attachable(anchor, spin, [orient], r|d, [cp], [offset], [anchors]) ... +// attachable(anchor, spin, , r|d, , , ) ... // Usage: VNF Geometry -// attachable(anchor, spin, [orient], vnf, [extent], [cp], [offset], [anchors]) ... +// attachable(anchor, spin, , vnf, , , , ) ... // // Description: // Manages the anchoring, spin, orientation, and attachments for a 3D volume or 2D area. @@ -969,8 +969,8 @@ module position(from) // Module: attach() // Usage: -// attach(from, [overlap]) ... -// attach(from, to, [overlap]) ... +// attach(from, ) ... +// attach(from, to, ) ... // Description: // Attaches children to a parent object at an anchor point and orientation. // Attached objects will be overlapped into the parent object by a little bit, @@ -1012,7 +1012,7 @@ module attach(from, to=undef, overlap=undef, norot=false) // Module: face_profile() // Usage: -// face_profile(faces=[], convexity=10, r, d) ... +// face_profile(faces, r, d, ) ... // Description: // Given a 2D edge profile, extrudes it into a mask for all edges and corners bounding each given face. // Arguments: @@ -1032,7 +1032,7 @@ module face_profile(faces=[], r, d, convexity=10) { // Module: edge_profile() // Usage: -// edge_profile([edges], [except], [convexity]) ... +// edge_profile(, , ) ... // Description: // Takes a 2D mask shape and attaches it to the selected edges, with the appropriate orientation // and extruded length to be `diff()`ed away, to give the edge a matching profile. @@ -1082,7 +1082,7 @@ module edge_profile(edges=EDGES_ALL, except=[], convexity=10) { // Module: corner_profile() // Usage: -// corner_profile([corners], [except], [convexity]) ... +// corner_profile(, , ) ... // Description: // Takes a 2D mask shape, rotationally extrudes and converts it into a corner mask, and attaches it // to the selected corners with the appropriate orientation. Tags it as a "mask" to allow it to be @@ -1144,7 +1144,7 @@ module corner_profile(corners=CORNERS_ALL, except=[], r, d, convexity=10) { // Module: edge_mask() // Usage: -// edge_mask([edges], [except]) ... +// edge_mask(, ) ... // Description: // Takes a 3D mask shape, and attaches it to the given edges, with the // appropriate orientation to be `diff()`ed away. @@ -1186,7 +1186,7 @@ module edge_mask(edges=EDGES_ALL, except=[]) { // Module: corner_mask() // Usage: -// corner_mask([corners], [except]) ... +// corner_mask(, ) ... // Description: // Takes a 3D mask shape, and attaches it to the given corners, with the appropriate // orientation to be `diff()`ed away. The 3D corner mask shape should be designed to @@ -1305,8 +1305,8 @@ module show(tags="") // Module: diff() // Usage: -// diff(neg, [keep]) ... -// diff(neg, pos, [keep]) ... +// diff(neg, ) ... +// diff(neg, pos, ) ... // Description: // If `neg` is given, takes the union of all children with tags that are in `neg`, and differences // them from the union of all children with tags in `pos`. If `pos` is not given, then all items in @@ -1363,8 +1363,8 @@ module diff(neg, pos=undef, keep=undef) // Module: intersect() // Usage: -// intersect(a, [keep]) ... -// intersect(a, b, [keep]) ... +// intersect(a, ) ... +// intersect(a, b, ) ... // Description: // If `a` is given, takes the union of all children with tags that are in `a`, and `intersection()`s // them with the union of all children with tags in `b`. If `b` is not given, then the union of all diff --git a/version.scad b/version.scad index e533b27..9757673 100644 --- a/version.scad +++ b/version.scad @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////////////// -BOSL_VERSION = [2,0,482]; +BOSL_VERSION = [2,0,483]; // Section: BOSL Library Version Functions