Merge pull request #547 from revarbat/revarbat_dev

Added hull.scad to std.scad.
This commit is contained in:
Revar Desmera 2021-05-23 17:53:56 -07:00 committed by GitHub
commit eade6f6f4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 36 deletions

View file

@ -46,4 +46,5 @@ PrioritizeFiles:
DefineHeader(BulletList): Side Effects DefineHeader(BulletList): Side Effects
DefineHeader(Table:Anchor Name|Position): Extra Anchors DefineHeader(Table:Anchor Name|Position): Extra Anchors
DefineHeader(Table:Name|Definition): Terminology DefineHeader(Table:Name|Definition): Terminology
DefineHeader(BulletList): Requirements

View file

@ -1261,8 +1261,10 @@ function compare_lists(a, b) =
// Function: any() // Function: any()
// Usage: // Usage:
// b = any(l); // bool = any(l);
// b = any(l,func); // bool = any(l,func); // Requires OpenSCAD 2021.01 or later.
// Requirements:
// Requires OpenSCAD 2021.01 or later to use the `func=` argument.
// Description: // Description:
// Returns true if any item in list `l` evaluates as true. // Returns true if any item in list `l` evaluates as true.
// Arguments: // Arguments:
@ -1292,8 +1294,10 @@ function _any_bool(l, i=0, out=false) =
// Function: all() // Function: all()
// Usage: // Usage:
// b = all(l); // bool = all(l);
// b = all(l,func); // bool = all(l,func); // Requires OpenSCAD 2021.01 or later.
// Requirements:
// Requires OpenSCAD 2021.01 or later to use the `func=` argument.
// Description: // Description:
// Returns true if all items in list `l` evaluate as true. If `func` is given a function liteal // Returns true if all items in list `l` evaluate as true. If `func` is given a function liteal
// of signature (x), returning bool, then that function literal is evaluated for each list item. // of signature (x), returning bool, then that function literal is evaluated for each list item.
@ -1325,8 +1329,10 @@ function _all_bool(l, i=0, out=true) =
// Function: count_true() // Function: count_true()
// Usage: // Usage:
// n = count_true(l,<nmax=>) // n = count_true(l,<nmax=>);
// n = count_true(l,func,<nmax=>) // n = count_true(l,func,<nmax=>); // Requires OpenSCAD 2021.01 or later.
// Requirements:
// Requires OpenSCAD 2021.01 or later to use the `func=` argument.
// Description: // Description:
// Returns the number of items in `l` that evaluate as true. // Returns the number of items in `l` that evaluate as true.
// If `l` is a lists of lists, this is applied recursively to each // If `l` is a lists of lists, this is applied recursively to each

View file

@ -387,10 +387,6 @@ function cuboid(
// Creates a rectangular prismoid shape with optional roundovers and chamfering. // Creates a rectangular prismoid shape with optional roundovers and chamfering.
// You can only round or chamfer the vertical(ish) edges. For those edges, you can // You can only round or chamfer the vertical(ish) edges. For those edges, you can
// specify rounding and/or chamferring per-edge, and for top and bottom separately. // specify rounding and/or chamferring per-edge, and for top and bottom separately.
// Note: if using chamfers or rounding, you **must** also include the hull.scad file:
// ```
// include <BOSL2/hull.scad>
// ```
// //
// Arguments: // Arguments:
// size1 = [width, length] of the bottom end of the prism. // size1 = [width, length] of the bottom end of the prism.
@ -398,12 +394,12 @@ function cuboid(
// h|l = Height of the prism. // h|l = Height of the prism.
// shift = [X,Y] amount to shift the center of the top end with respect to the center of the bottom end. // shift = [X,Y] amount to shift the center of the top end with respect to the center of the bottom end.
// --- // ---
// rounding = The roundover radius for the vertical-ish edges of the prismoid. Requires including hull.scad. If given as a list of four numbers, gives individual radii for each corner, in the order [X+Y+,X-Y+,X-Y-,X+Y-]. Default: 0 (no rounding) // rounding = The roundover radius for the vertical-ish edges of the prismoid. If given as a list of four numbers, gives individual radii for each corner, in the order [X+Y+,X-Y+,X-Y-,X+Y-]. Default: 0 (no rounding)
// rounding1 = The roundover radius for the bottom of the vertical-ish edges of the prismoid. Requires including hull.scad. If given as a list of four numbers, gives individual radii for each corner, in the order [X+Y+,X-Y+,X-Y-,X+Y-]. // rounding1 = The roundover radius for the bottom of the vertical-ish edges of the prismoid. If given as a list of four numbers, gives individual radii for each corner, in the order [X+Y+,X-Y+,X-Y-,X+Y-].
// rounding2 = The roundover radius for the top of the vertical-ish edges of the prismoid. Requires including hull.scad. If given as a list of four numbers, gives individual radii for each corner, in the order [X+Y+,X-Y+,X-Y-,X+Y-]. // rounding2 = The roundover radius for the top of the vertical-ish edges of the prismoid. If given as a list of four numbers, gives individual radii for each corner, in the order [X+Y+,X-Y+,X-Y-,X+Y-].
// chamfer = The chamfer size for the vertical-ish edges of the prismoid. Requires including hull.scad. If given as a list of four numbers, gives individual chamfers for each corner, in the order [X+Y+,X-Y+,X-Y-,X+Y-]. Default: 0 (no chamfer) // chamfer = The chamfer size for the vertical-ish edges of the prismoid. If given as a list of four numbers, gives individual chamfers for each corner, in the order [X+Y+,X-Y+,X-Y-,X+Y-]. Default: 0 (no chamfer)
// chamfer1 = The chamfer size for the bottom of the vertical-ish edges of the prismoid. Requires including hull.scad. If given as a list of four numbers, gives individual chamfers for each corner, in the order [X+Y+,X-Y+,X-Y-,X+Y-]. // chamfer1 = The chamfer size for the bottom of the vertical-ish edges of the prismoid. If given as a list of four numbers, gives individual chamfers for each corner, in the order [X+Y+,X-Y+,X-Y-,X+Y-].
// chamfer2 = The chamfer size for the top of the vertical-ish edges of the prismoid. Requires including hull.scad. If given as a list of four numbers, gives individual chamfers for each corner, in the order [X+Y+,X-Y+,X-Y-,X+Y-]. // chamfer2 = The chamfer size for the top of the vertical-ish edges of the prismoid. If given as a list of four numbers, gives individual chamfers for each corner, in the order [X+Y+,X-Y+,X-Y-,X+Y-].
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER` // 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` // 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` // orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP`
@ -425,29 +421,22 @@ function cuboid(
// Example(FlatSpin,VPD=160,VPT=[0,0,10]): Shifting/Skewing // Example(FlatSpin,VPD=160,VPT=[0,0,10]): Shifting/Skewing
// prismoid(size1=[50,30], size2=[20,20], h=20, shift=[15,5]); // prismoid(size1=[50,30], size2=[20,20], h=20, shift=[15,5]);
// Example: Rounding // Example: Rounding
// include <BOSL2/hull.scad>
// prismoid(100, 80, rounding=10, h=30); // prismoid(100, 80, rounding=10, h=30);
// Example: Outer Chamfer Only // Example: Outer Chamfer Only
// include <BOSL2/hull.scad>
// prismoid(100, 80, chamfer=5, h=30); // prismoid(100, 80, chamfer=5, h=30);
// Example: Gradiant Rounding // Example: Gradiant Rounding
// include <BOSL2/hull.scad>
// prismoid(100, 80, rounding1=10, rounding2=0, h=30); // prismoid(100, 80, rounding1=10, rounding2=0, h=30);
// Example: Per Corner Rounding // Example: Per Corner Rounding
// include <BOSL2/hull.scad>
// prismoid(100, 80, rounding=[0,5,10,15], h=30); // prismoid(100, 80, rounding=[0,5,10,15], h=30);
// Example: Per Corner Chamfer // Example: Per Corner Chamfer
// include <BOSL2/hull.scad>
// prismoid(100, 80, chamfer=[0,5,10,15], h=30); // prismoid(100, 80, chamfer=[0,5,10,15], h=30);
// Example: Mixing Chamfer and Rounding // Example: Mixing Chamfer and Rounding
// include <BOSL2/hull.scad>
// prismoid( // prismoid(
// 100, 80, h=30, // 100, 80, h=30,
// chamfer=[0,5,0,10], // chamfer=[0,5,0,10],
// rounding=[5,0,10,0] // rounding=[5,0,10,0]
// ); // );
// Example: Really Mixing It Up // Example: Really Mixing It Up
// include <BOSL2/hull.scad>
// prismoid( // prismoid(
// size1=[100,80], size2=[80,60], h=20, // size1=[100,80], size2=[80,60], h=20,
// chamfer1=[0,5,0,10], chamfer2=[5,0,10,0], // chamfer1=[0,5,0,10], chamfer2=[5,0,10,0],
@ -579,10 +568,6 @@ function prismoid(
// You can only round or chamfer the vertical(ish) edges. For those edges, you can // You can only round or chamfer the vertical(ish) edges. For those edges, you can
// specify rounding and/or chamferring per-edge, and for top and bottom, inside and // specify rounding and/or chamferring per-edge, and for top and bottom, inside and
// outside separately. // outside separately.
// Note: if using chamfers or rounding, you **must** also include the hull.scad file:
// ```
// include <BOSL2/hull.scad>
// ```
// Arguments: // Arguments:
// h|l = The height or length of the rectangular tube. Default: 1 // h|l = The height or length of the rectangular tube. Default: 1
// size = The outer [X,Y] size of the rectangular tube. // size = The outer [X,Y] size of the rectangular tube.
@ -622,45 +607,36 @@ function prismoid(
// isize1=[40,20], isize2=[65,35], h=15 // isize1=[40,20], isize2=[65,35], h=15
// ); // );
// Example: Outer Rounding Only // Example: Outer Rounding Only
// include <BOSL2/hull.scad>
// rect_tube(size=100, wall=5, rounding=10, irounding=0, h=30); // rect_tube(size=100, wall=5, rounding=10, irounding=0, h=30);
// Example: Outer Chamfer Only // Example: Outer Chamfer Only
// include <BOSL2/hull.scad>
// rect_tube(size=100, wall=5, chamfer=5, ichamfer=0, h=30); // rect_tube(size=100, wall=5, chamfer=5, ichamfer=0, h=30);
// Example: Outer Rounding, Inner Chamfer // Example: Outer Rounding, Inner Chamfer
// include <BOSL2/hull.scad>
// rect_tube(size=100, wall=5, rounding=10, ichamfer=8, h=30); // rect_tube(size=100, wall=5, rounding=10, ichamfer=8, h=30);
// Example: Inner Rounding, Outer Chamfer // Example: Inner Rounding, Outer Chamfer
// include <BOSL2/hull.scad>
// rect_tube(size=100, wall=5, chamfer=10, irounding=8, h=30); // rect_tube(size=100, wall=5, chamfer=10, irounding=8, h=30);
// Example: Gradiant Rounding // Example: Gradiant Rounding
// include <BOSL2/hull.scad>
// rect_tube( // rect_tube(
// size1=100, size2=80, wall=5, h=30, // size1=100, size2=80, wall=5, h=30,
// rounding1=10, rounding2=0, // rounding1=10, rounding2=0,
// irounding1=8, irounding2=0 // irounding1=8, irounding2=0
// ); // );
// Example: Per Corner Rounding // Example: Per Corner Rounding
// include <BOSL2/hull.scad>
// rect_tube( // rect_tube(
// size=100, wall=10, h=30, // size=100, wall=10, h=30,
// rounding=[0,5,10,15], irounding=0 // rounding=[0,5,10,15], irounding=0
// ); // );
// Example: Per Corner Chamfer // Example: Per Corner Chamfer
// include <BOSL2/hull.scad>
// rect_tube( // rect_tube(
// size=100, wall=10, h=30, // size=100, wall=10, h=30,
// chamfer=[0,5,10,15], ichamfer=0 // chamfer=[0,5,10,15], ichamfer=0
// ); // );
// Example: Mixing Chamfer and Rounding // Example: Mixing Chamfer and Rounding
// include <BOSL2/hull.scad>
// rect_tube( // rect_tube(
// size=100, wall=10, h=30, // size=100, wall=10, h=30,
// chamfer=[0,5,0,10], ichamfer=0, // chamfer=[0,5,0,10], ichamfer=0,
// rounding=[5,0,10,0], irounding=0 // rounding=[5,0,10,0], irounding=0
// ); // );
// Example: Really Mixing It Up // Example: Really Mixing It Up
// include <BOSL2/hull.scad>
// rect_tube( // rect_tube(
// size1=[100,80], size2=[80,60], // size1=[100,80], size2=[80,60],
// isize1=[50,30], isize2=[70,50], h=20, // isize1=[50,30], isize2=[70,50], h=20,

View file

@ -27,6 +27,7 @@ include <quaternions.scad>
include <affine.scad> include <affine.scad>
include <coords.scad> include <coords.scad>
include <geometry.scad> include <geometry.scad>
include <hull.scad>
include <regions.scad> include <regions.scad>
include <strings.scad> include <strings.scad>
include <skin.scad> include <skin.scad>