From 2bf6c345647bf37e0424a43149a6833b0a50c643 Mon Sep 17 00:00:00 2001 From: Garth Minette Date: Thu, 15 Oct 2020 19:14:14 -0700 Subject: [PATCH 1/2] Fixed spheroid() orig and aligned styles. --- primitives.scad | 6 +++--- shapes.scad | 4 ++-- shapes2d.scad | 8 ++++---- version.scad | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/primitives.scad b/primitives.scad index 60f6e5a..8386094 100644 --- a/primitives.scad +++ b/primitives.scad @@ -238,7 +238,7 @@ function cylinder(h, r1, r2, center, l, r, d, d1, d2, anchor, spin=0, orient=UP) // r = Radius of the sphere. // d = Diameter of the sphere. // circum = If true, the sphere is made large enough to circumscribe the sphere of the ideal side. Otherwise inscribes. Default: false (inscribes) -// style = The style of the sphere's construction. One of "orig", "aligned", "stagger", or "icosa". Default: "orig" +// style = The style of the sphere's construction. One of "orig", "aligned", "stagger", "octa", or "icosa". Default: "orig" // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP` @@ -267,11 +267,11 @@ function cylinder(h, r1, r2, center, l, r, d, d1, d2, anchor, spin=0, orient=UP) // Example: Called as Function // vnf = sphere(d=100, style="icosa"); // vnf_polyhedron(vnf); -module sphere(r, d, circum=false, style="aligned", anchor=CENTER, spin=0, orient=UP) +module sphere(r, d, circum=false, style="orig", anchor=CENTER, spin=0, orient=UP) spheroid(r=r, d=d, circum=circum, style=style, anchor=anchor, spin=spin, orient=orient) children(); -function sphere(r, d, circum=false, style="aligned", anchor=CENTER, spin=0, orient=UP) = +function sphere(r, d, circum=false, style="orig", anchor=CENTER, spin=0, orient=UP) = spheroid(r=r, d=d, circum=circum, style=style, anchor=anchor, spin=spin, orient=orient); diff --git a/shapes.scad b/shapes.scad index 4ddd9dd..054053f 100644 --- a/shapes.scad +++ b/shapes.scad @@ -1182,14 +1182,14 @@ module spheroid(r, d, circum=false, style="aligned", anchor=CENTER, spin=0, orie if (style=="orig") { rotate_extrude(convexity=2,$fn=sides) { difference() { - oval(r=r, circum=circum, $fn=sides); + oval(r=r, circum=circum, realign=true, $fn=sides); left(r) square(2*r,center=true); } } } else if (style=="aligned") { rotate_extrude(convexity=2,$fn=sides) { difference() { - zrot(180/sides) oval(r=r, circum=circum, $fn=sides); + oval(r=r, circum=circum, $fn=sides); left(r) square(2*r,center=true); } } diff --git a/shapes2d.scad b/shapes2d.scad index 8906650..6b5a6dd 100644 --- a/shapes2d.scad +++ b/shapes2d.scad @@ -269,18 +269,18 @@ module stroke( if (hull) { hull(){ multmatrix(rotmats[i]) { - sphere(d=widths[i]); + sphere(d=widths[i],style="aligned"); } multmatrix(rotmats[i-1]) { - sphere(d=widths[i]); + sphere(d=widths[i],style="aligned"); } } } else { multmatrix(rotmats[i]) { - sphere(d=widths[i]); + sphere(d=widths[i],style="aligned"); } multmatrix(rotmats[i-1]) { - sphere(d=widths[i]); + sphere(d=widths[i],style="aligned"); } } } diff --git a/version.scad b/version.scad index 6d4badb..7a122b3 100644 --- a/version.scad +++ b/version.scad @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////////////// -BOSL_VERSION = [2,0,449]; +BOSL_VERSION = [2,0,450]; // Section: BOSL Library Version Functions From 41ab991c157f37f775a8d2bdb1e1580e344d1225 Mon Sep 17 00:00:00 2001 From: Garth Minette Date: Thu, 15 Oct 2020 19:21:36 -0700 Subject: [PATCH 2/2] Fixed bad spheroid() regression. --- tests/test_primitives.scad | 2 +- version.scad | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_primitives.scad b/tests/test_primitives.scad index e903617..e8671be 100644 --- a/tests/test_primitives.scad +++ b/tests/test_primitives.scad @@ -51,7 +51,7 @@ test_cylinder(); module test_sphere() { $fn=6; - assert_approx(sphere(r=40), [[[0,0,40],[34.6410161514,0,20],[17.3205080757,30,20],[-17.3205080757,30,20],[-34.6410161514,0,20],[-17.3205080757,-30,20],[17.3205080757,-30,20],[34.6410161514,0,-20],[17.3205080757,30,-20],[-17.3205080757,30,-20],[-34.6410161514,0,-20],[-17.3205080757,-30,-20],[17.3205080757,-30,-20],[0,0,-40]],[[1,0,2],[13,7,8],[2,0,3],[13,8,9],[3,0,4],[13,9,10],[4,0,5],[13,10,11],[5,0,6],[13,11,12],[6,0,1],[13,12,7],[1,2,8],[1,8,7],[2,3,9],[2,9,8],[3,4,10],[3,10,9],[4,5,11],[4,11,10],[5,6,12],[5,12,11],[6,1,7],[6,7,12]]]); + assert_approx(sphere(r=40), [[[20,0,34.6410161514],[10,17.3205080757,34.6410161514],[-10,17.3205080757,34.6410161514],[-20,0,34.6410161514],[-10,-17.3205080757,34.6410161514],[10,-17.3205080757,34.6410161514],[40,0,0],[20,34.6410161514,0],[-20,34.6410161514,0],[-40,0,0],[-20,-34.6410161514,0],[20,-34.6410161514,0],[20,0,-34.6410161514],[10,17.3205080757,-34.6410161514],[-10,17.3205080757,-34.6410161514],[-20,0,-34.6410161514],[-10,-17.3205080757,-34.6410161514],[10,-17.3205080757,-34.6410161514]],[[5,4,3,2,1,0],[12,13,14,15,16,17],[6,0,1],[6,1,7],[7,1,2],[7,2,8],[8,2,3],[8,3,9],[9,3,4],[9,4,10],[10,4,5],[10,5,11],[11,5,0],[11,0,6],[12,6,7],[12,7,13],[13,7,8],[13,8,14],[14,8,9],[14,9,15],[15,9,10],[15,10,16],[16,10,11],[16,11,17],[17,11,6],[17,6,12]]]); assert_approx(sphere(r=40,style="orig"), [[[20,0,34.6410161514],[10,17.3205080757,34.6410161514],[-10,17.3205080757,34.6410161514],[-20,0,34.6410161514],[-10,-17.3205080757,34.6410161514],[10,-17.3205080757,34.6410161514],[40,0,0],[20,34.6410161514,0],[-20,34.6410161514,0],[-40,0,0],[-20,-34.6410161514,0],[20,-34.6410161514,0],[20,0,-34.6410161514],[10,17.3205080757,-34.6410161514],[-10,17.3205080757,-34.6410161514],[-20,0,-34.6410161514],[-10,-17.3205080757,-34.6410161514],[10,-17.3205080757,-34.6410161514]],[[5,4,3,2,1,0],[12,13,14,15,16,17],[6,0,1],[6,1,7],[7,1,2],[7,2,8],[8,2,3],[8,3,9],[9,3,4],[9,4,10],[10,4,5],[10,5,11],[11,5,0],[11,0,6],[12,6,7],[12,7,13],[13,7,8],[13,8,14],[14,8,9],[14,9,15],[15,9,10],[15,10,16],[16,10,11],[16,11,17],[17,11,6],[17,6,12]]]); assert_approx(sphere(r=40,style="aligned"), [[[0,0,40],[34.6410161514,0,20],[17.3205080757,30,20],[-17.3205080757,30,20],[-34.6410161514,0,20],[-17.3205080757,-30,20],[17.3205080757,-30,20],[34.6410161514,0,-20],[17.3205080757,30,-20],[-17.3205080757,30,-20],[-34.6410161514,0,-20],[-17.3205080757,-30,-20],[17.3205080757,-30,-20],[0,0,-40]],[[1,0,2],[13,7,8],[2,0,3],[13,8,9],[3,0,4],[13,9,10],[4,0,5],[13,10,11],[5,0,6],[13,11,12],[6,0,1],[13,12,7],[1,2,8],[1,8,7],[2,3,9],[2,9,8],[3,4,10],[3,10,9],[4,5,11],[4,11,10],[5,6,12],[5,12,11],[6,1,7],[6,7,12]]]); assert_approx(sphere(r=40,style="stagger"), [[[0,0,40],[30,17.3205080757,20],[0,34.6410161514,20],[-30,17.3205080757,20],[-30,-17.3205080757,20],[0,-34.6410161514,20],[30,-17.3205080757,20],[34.6410161514,0,-20],[17.3205080757,30,-20],[-17.3205080757,30,-20],[-34.6410161514,0,-20],[-17.3205080757,-30,-20],[17.3205080757,-30,-20],[0,0,-40]],[[1,0,2],[13,7,8],[2,0,3],[13,8,9],[3,0,4],[13,9,10],[4,0,5],[13,10,11],[5,0,6],[13,11,12],[6,0,1],[13,12,7],[1,2,8],[1,8,7],[2,3,9],[2,9,8],[3,4,10],[3,10,9],[4,5,11],[4,11,10],[5,6,12],[5,12,11],[6,1,7],[6,7,12]]]); diff --git a/version.scad b/version.scad index 7a122b3..e44e32c 100644 --- a/version.scad +++ b/version.scad @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////////////// -BOSL_VERSION = [2,0,450]; +BOSL_VERSION = [2,0,451]; // Section: BOSL Library Version Functions