doc fixes

This commit is contained in:
Adrian Mariano 2021-11-10 19:58:47 -05:00
parent 8d1b8ac302
commit 727bc43401
3 changed files with 31 additions and 25 deletions

View file

@ -504,8 +504,10 @@ module hulling(a)
// Description: // Description:
// Takes a 3D mask shape, and attaches it to the given edges, with the appropriate orientation to be // Takes a 3D mask shape, and attaches it to the given edges, with the appropriate orientation to be
// `diff()`ed away. The mask shape should be vertically oriented (Z-aligned) with the back-right // `diff()`ed away. The mask shape should be vertically oriented (Z-aligned) with the back-right
// quadrant (X+Y+) shaped to be diffed away from the edge of parent attachable shape. For a more // quadrant (X+Y+) shaped to be diffed away from the edge of parent attachable shape.
// step-by-step explanation of attachments, see the [[Attachments Tutorial|Tutorial-Attachments]]. // For details on specifying the edges to mask see [Specifying Edges](edges.scad#section-specifying-edges).
// For a step-by-step explanation of attachments, see the [[Attachments Tutorial|Tutorial-Attachments]].
//
// Figure: A Typical Edge Rounding Mask // Figure: A Typical Edge Rounding Mask
// module roundit(l,r) difference() { // module roundit(l,r) difference() {
// translate([-1,-1,-l/2]) // translate([-1,-1,-l/2])
@ -515,8 +517,8 @@ module hulling(a)
// } // }
// roundit(l=30,r=10); // roundit(l=30,r=10);
// Arguments: // Arguments:
// edges = Edges to mask. See the docs for [`edges()`](edges.scad#edges) to see acceptable values. Default: All edges. // edges = Edges to mask. See [Specifying Edges](edges.scad#section-specifying-edges). Default: All edges.
// except = Edges to explicitly NOT mask. See the docs for [`edges()`](edges.scad#edges) to see acceptable values. Default: No edges. // except = Edges to explicitly NOT mask. See [Specifying Edges](edges.scad#section-specifying-edges). Default: No edges.
// Side Effects: // Side Effects:
// Sets `$tags = "mask"` for all children. // Sets `$tags = "mask"` for all children.
// Example: // Example:
@ -574,7 +576,7 @@ module edge_mask(edges=EDGES_ALL, except=[]) {
// } // }
module corner_mask(corners=CORNERS_ALL, except=[]) { module corner_mask(corners=CORNERS_ALL, except=[]) {
assert($parent_geom != undef, "No object to attach to!"); assert($parent_geom != undef, "No object to attach to!");
corners = corners(corners, except=except); corners = _corners(corners, except=except);
vecs = [for (i = [0:7]) if (corners[i]>0) CORNER_OFFSETS[i]]; vecs = [for (i = [0:7]) if (corners[i]>0) CORNER_OFFSETS[i]];
for (vec = vecs) { for (vec = vecs) {
vcount = (vec.x?1:0) + (vec.y?1:0) + (vec.z?1:0); vcount = (vec.x?1:0) + (vec.y?1:0) + (vec.z?1:0);
@ -630,11 +632,13 @@ module face_profile(faces=[], r, d, convexity=10) {
// See Also: attachable(), position(), attach(), face_profile(), corner_profile() // See Also: attachable(), position(), attach(), face_profile(), corner_profile()
// Description: // Description:
// Takes a 2D mask shape and attaches it to the selected edges, with the appropriate orientation and // 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. For a more step-by-step // extruded length to be `diff()`ed away, to give the edge a matching profile.
// For details on specifying the edges to mask see [Specifying Edges](edges.scad#section-specifying-edges).
// For a step-by-step
// explanation of attachments, see the [[Attachments Tutorial|Tutorial-Attachments]]. // explanation of attachments, see the [[Attachments Tutorial|Tutorial-Attachments]].
// Arguments: // Arguments:
// edges = Edges to mask. See the docs for [`edges()`](edges.scad#edges) to see acceptable values. Default: All edges. // edges = Edges to mask. See [Specifying Edges](edges.scad#section-specifying-edges). Default: All edges.
// except = Edges to explicitly NOT mask. See the docs for [`edges()`](edges.scad#edges) to see acceptable values. Default: No edges. // except = Edges to explicitly NOT mask. See [Specifying Edges](edges.scad#section-specifying-edges). Default: No edges.
// convexity = Max number of times a line could intersect the perimeter of the mask shape. Default: 10 // convexity = Max number of times a line could intersect the perimeter of the mask shape. Default: 10
// Side Effects: // Side Effects:
// Sets `$tags = "mask"` for all children. // Sets `$tags = "mask"` for all children.

View file

@ -1276,7 +1276,7 @@ function bezier_patch(patch, splinesteps=16, style="default") =
// [[0, 10, 8.75], [0, 5, 8.75], [0, 0, 8.75], [-5, 0, 8.75], [-10, 0, 8.75]], // [[0, 10, 8.75], [0, 5, 8.75], [0, 0, 8.75], [-5, 0, 8.75], [-10, 0, 8.75]],
// [[0, 10, 2.5], [0, 5, 2.5], [0, 0, 2.5], [-5, 0, 2.5], [-10, 0, 2.5]] // [[0, 10, 2.5], [0, 5, 2.5], [0, 0, 2.5], [-5, 0, 2.5], [-10, 0, 2.5]]
// ]; // ];
// vnf_wireframe((bezier_patch(patch, splinesteps)),d=0.1); // vnf_wireframe((bezier_patch(patch, splinesteps)),width=0.1);
// color("red")move_copies(flatten(patch)) sphere(r=0.3,$fn=9); // color("red")move_copies(flatten(patch)) sphere(r=0.3,$fn=9);
// Example(3D): With bezier_patch_degenerate the degenerate point does not have excess triangles. The top half of the patch decreases the number of sampled points by 2 for each row. // Example(3D): With bezier_patch_degenerate the degenerate point does not have excess triangles. The top half of the patch decreases the number of sampled points by 2 for each row.
// splinesteps=8; // splinesteps=8;
@ -1287,7 +1287,7 @@ function bezier_patch(patch, splinesteps=16, style="default") =
// [[0, 10, 8.75], [0, 5, 8.75], [0, 0, 8.75], [-5, 0, 8.75], [-10, 0, 8.75]], // [[0, 10, 8.75], [0, 5, 8.75], [0, 0, 8.75], [-5, 0, 8.75], [-10, 0, 8.75]],
// [[0, 10, 2.5], [0, 5, 2.5], [0, 0, 2.5], [-5, 0, 2.5], [-10, 0, 2.5]] // [[0, 10, 2.5], [0, 5, 2.5], [0, 0, 2.5], [-5, 0, 2.5], [-10, 0, 2.5]]
// ]; // ];
// vnf_wireframe(bezier_patch_degenerate(patch, splinesteps),d=0.1); // vnf_wireframe(bezier_patch_degenerate(patch, splinesteps),width=0.1);
// color("red")move_copies(flatten(patch)) sphere(r=0.3,$fn=9); // color("red")move_copies(flatten(patch)) sphere(r=0.3,$fn=9);
// Example(3D): With splinesteps odd you get one "odd" row where the point count decreases by 1 instead of 2. You may prefer even values for splinesteps to avoid this. // Example(3D): With splinesteps odd you get one "odd" row where the point count decreases by 1 instead of 2. You may prefer even values for splinesteps to avoid this.
// splinesteps=7; // splinesteps=7;
@ -1298,7 +1298,7 @@ function bezier_patch(patch, splinesteps=16, style="default") =
// [[0, 10, 8.75], [0, 5, 8.75], [0, 0, 8.75], [-5, 0, 8.75], [-10, 0, 8.75]], // [[0, 10, 8.75], [0, 5, 8.75], [0, 0, 8.75], [-5, 0, 8.75], [-10, 0, 8.75]],
// [[0, 10, 2.5], [0, 5, 2.5], [0, 0, 2.5], [-5, 0, 2.5], [-10, 0, 2.5]] // [[0, 10, 2.5], [0, 5, 2.5], [0, 0, 2.5], [-5, 0, 2.5], [-10, 0, 2.5]]
// ]; // ];
// vnf_wireframe(bezier_patch_degenerate(patch, splinesteps),d=0.1); // vnf_wireframe(bezier_patch_degenerate(patch, splinesteps),width=0.1);
// color("red")move_copies(flatten(patch)) sphere(r=0.3,$fn=9); // color("red")move_copies(flatten(patch)) sphere(r=0.3,$fn=9);
// Example(3D): A more extreme degeneracy occurs when the top half of a patch is degenerate to a line. (For odd length patches the middle row must be degenerate to trigger this style.) In this case the number of points in each row decreases by 1 for every row. It doesn't matter of splinesteps is odd or even. // Example(3D): A more extreme degeneracy occurs when the top half of a patch is degenerate to a line. (For odd length patches the middle row must be degenerate to trigger this style.) In this case the number of points in each row decreases by 1 for every row. It doesn't matter of splinesteps is odd or even.
// splinesteps=8; // splinesteps=8;
@ -1308,7 +1308,7 @@ function bezier_patch(patch, splinesteps=16, style="default") =
// repeat([0,0,5],5), // repeat([0,0,5],5),
// repeat([0,0,10],5) // repeat([0,0,10],5)
// ]; // ];
// vnf_wireframe(bezier_patch_degenerate(patch, splinesteps),d=0.1); // vnf_wireframe(bezier_patch_degenerate(patch, splinesteps),width=0.1);
// color("red")move_copies(flatten(patch)) sphere(r=0.3,$fn=9); // color("red")move_copies(flatten(patch)) sphere(r=0.3,$fn=9);
// Example(3D): Here is a degenerate cubic patch. // Example(3D): Here is a degenerate cubic patch.
// splinesteps=8; // splinesteps=8;
@ -1318,7 +1318,7 @@ function bezier_patch(patch, splinesteps=16, style="default") =
// repeat([0,0,30],4) // repeat([0,0,30],4)
// ]; // ];
// color("red")move_copies(flatten(patch)) sphere(r=0.3,$fn=9); // color("red")move_copies(flatten(patch)) sphere(r=0.3,$fn=9);
// vnf_wireframe(bezier_patch_degenerate(patch, splinesteps),d=0.1); // vnf_wireframe(bezier_patch_degenerate(patch, splinesteps),width=0.1);
// Example(3D): A more extreme degenerate cubic patch, where two rows are equal. // Example(3D): A more extreme degenerate cubic patch, where two rows are equal.
// splinesteps=8; // splinesteps=8;
// patch = [ [ [-20,0,0], [-10,0,0],[0,10,0],[0,20,0] ], // patch = [ [ [-20,0,0], [-10,0,0],[0,10,0],[0,20,0] ],
@ -1327,13 +1327,13 @@ function bezier_patch(patch, splinesteps=16, style="default") =
// repeat([-10,10,30],4) // repeat([-10,10,30],4)
// ]; // ];
// color("red")move_copies(flatten(patch)) sphere(r=0.3,$fn=9); // color("red")move_copies(flatten(patch)) sphere(r=0.3,$fn=9);
// vnf_wireframe(bezier_patch_degenerate(patch, splinesteps),d=0.1); // vnf_wireframe(bezier_patch_degenerate(patch, splinesteps),width=0.1);
// Example(3D): Quadratic patch degenerate at the right side: // Example(3D): Quadratic patch degenerate at the right side:
// splinesteps=8; // splinesteps=8;
// patch = [[[0, -10, 0],[10, -5, 0],[20, 0, 0]], // patch = [[[0, -10, 0],[10, -5, 0],[20, 0, 0]],
// [[0, 0, 0], [10, 0, 0], [20, 0, 0]], // [[0, 0, 0], [10, 0, 0], [20, 0, 0]],
// [[0, 0, 10], [10, 0, 5], [20, 0, 0]]]; // [[0, 0, 10], [10, 0, 5], [20, 0, 0]]];
// vnf_wireframe(bezier_patch_degenerate(patch, splinesteps),d=0.1); // vnf_wireframe(bezier_patch_degenerate(patch, splinesteps),width=0.1);
// color("red")move_copies(flatten(patch)) sphere(r=0.3,$fn=9); // color("red")move_copies(flatten(patch)) sphere(r=0.3,$fn=9);
// Example(3D): Cubic patch degenerate at both ends. In this case the point count changes by 2 at every row. // Example(3D): Cubic patch degenerate at both ends. In this case the point count changes by 2 at every row.
// splinesteps=8; // splinesteps=8;
@ -1343,7 +1343,7 @@ function bezier_patch(patch, splinesteps=16, style="default") =
// [ [-20,0,10], [-10,0,10],[0,10,10],[0,20,10] ], // [ [-20,0,10], [-10,0,10],[0,10,10],[0,20,10] ],
// repeat([-10,10,20],4), // repeat([-10,10,20],4),
// ]; // ];
// vnf_wireframe(bezier_patch_degenerate(patch, splinesteps),d=0.1); // vnf_wireframe(bezier_patch_degenerate(patch, splinesteps),width=0.1);
// color("red")move_copies(flatten(patch)) sphere(r=0.3,$fn=9); // color("red")move_copies(flatten(patch)) sphere(r=0.3,$fn=9);
function bezier_patch_degenerate(patch, splinesteps=16, reverse=false, return_edges=false) = function bezier_patch_degenerate(patch, splinesteps=16, reverse=false, return_edges=false) =
!return_edges ? bezier_patch_degenerate(patch, splinesteps, reverse, true)[0] : !return_edges ? bezier_patch_degenerate(patch, splinesteps, reverse, true)[0] :

View file

@ -89,24 +89,26 @@ function cube(size=1, center, anchor, spin=0, orient=UP) =
// cuboid(size, p1=, ...); // cuboid(size, p1=, ...);
// cuboid(p1=, p2=, ...); // cuboid(p1=, p2=, ...);
// Usage: Chamfered Cubes // Usage: Chamfered Cubes
// cuboid(size, [chamfer=], [edges=], [except_edges=], [trimcorners=], ...); // cuboid(size, [chamfer=], [edges=], [except=], [trimcorners=], ...);
// Usage: Rounded Cubes // Usage: Rounded Cubes
// cuboid(size, [rounding=], [edges=], [except_edges=], [trimcorners=], ...); // cuboid(size, [rounding=], [edges=], [except=], [trimcorners=], ...);
// Usage: Attaching children // Usage: Attaching children
// cuboid(size, [anchor=], ...) [attachments]; // cuboid(size, [anchor=], ...) [attachments];
// //
// Description: // Description:
// Creates a cube or cuboid object, with optional chamfering or rounding. // Creates a cube or cuboid object, with optional chamfering or rounding of edges and corners.
// Negative chamfers and roundings can be applied to create external masks, // Negative chamfers and roundings can be applied to create external fillets, but they
// but only apply to edges around the top or bottom faces. // but only apply to edges around the top or bottom faces. If you specify an edge set other than "ALL"
// with such roundings or chamfers then you will get an error. See
// [Specifying Edges](edges.scad#section-specifying-edges) for information on how to specify edge sets.
// //
// Arguments: // Arguments:
// size = The size of the cube. // size = The size of the cube.
// --- // ---
// chamfer = Size of chamfer, inset from sides. Default: No chamfering. // chamfer = Size of chamfer, inset from sides. Default: No chamfering.
// rounding = Radius of the edge rounding. Default: No rounding. // rounding = Radius of the edge rounding. Default: No rounding.
// edges = Edges to chamfer/round. See the docs for [`edges()`](edges.scad#edges) to see acceptable values. Default: All edges. // edges = Edges to mask. See [Specifying Edges](edges.scad#section-specifying-edges). Default: all edges.
// except = Edges to explicitly NOT chamfer/round. See the docs for [`edges()`](edges.scad#edges) to see acceptable values. Default: No edges. // except = Edges to explicitly NOT mask. See [Specifying Edges](edges.scad#section-specifying-edges). Default: No edges.
// trimcorners = If true, rounds or chamfers corners where three chamfered/rounded edges meet. Default: `true` // trimcorners = If true, rounds or chamfers corners where three chamfered/rounded edges meet. Default: `true`
// p1 = Align the cuboid's corner at `p1`, if given. Forces `anchor=ALLNEG`. // p1 = Align the cuboid's corner at `p1`, if given. Forces `anchor=ALLNEG`.
// p2 = If given with `p1`, defines the cornerpoints of the cuboid. // p2 = If given with `p1`, defines the cornerpoints of the cuboid.
@ -230,8 +232,8 @@ module cuboid(
edges = _edges(edges, except=first_defined([except_edges,except])); edges = _edges(edges, except=first_defined([except_edges,except]));
assert(is_vector(size,3)); assert(is_vector(size,3));
assert(all_positive(size)); assert(all_positive(size));
assert(is_undef(chamfer) || is_finite(chamfer)); assert(is_undef(chamfer) || is_finite(chamfer),"chamfer must be a finite value");
assert(is_undef(rounding) || is_finite(rounding)); assert(is_undef(rounding) || is_finite(rounding),"rounding must be a finite value");
assert(is_undef(p1) || is_vector(p1)); assert(is_undef(p1) || is_vector(p1));
assert(is_undef(p2) || is_vector(p2)); assert(is_undef(p2) || is_vector(p2));
assert(is_bool(trimcorners)); assert(is_bool(trimcorners));