mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-28 23:39:36 +00:00
debug function rename
attachment function reorder add axes to egg examples
This commit is contained in:
parent
c61f7b8439
commit
f5d0854549
6 changed files with 107 additions and 105 deletions
120
attachments.scad
120
attachments.scad
|
@ -528,65 +528,6 @@ module tags(tags)
|
|||
}
|
||||
|
||||
|
||||
// Module: recolor()
|
||||
// Usage:
|
||||
// recolor(c) {...}
|
||||
// Topics: Attachments
|
||||
// See Also: tags(), hide(), show(), diff(), intersect()
|
||||
// Description:
|
||||
// Sets the color for children that can use the $color special variable. For a more step-by-step
|
||||
// explanation of attachments, see the [[Attachments Tutorial|Tutorial-Attachments]].
|
||||
// Arguments:
|
||||
// c = Color name or RGBA vector.
|
||||
// Example:
|
||||
// recolor("red") cyl(l=20, d=10);
|
||||
module recolor(c)
|
||||
{
|
||||
$color = c;
|
||||
children();
|
||||
}
|
||||
|
||||
|
||||
// Module: hide()
|
||||
// Usage:
|
||||
// hide(tags) {...}
|
||||
// Topics: Attachments
|
||||
// See Also: tags(), recolor(), show(), diff(), intersect()
|
||||
// Description:
|
||||
// Hides all children with the given tags. Overrides any previous `hide()` or `show()` calls.
|
||||
// For a more step-by-step explanation of attachments, see the [[Attachments Tutorial|Tutorial-Attachments]].
|
||||
// Example:
|
||||
// hide("A") cube(50, anchor=CENTER, $tags="Main") {
|
||||
// attach(LEFT, BOTTOM) cylinder(d=30, l=30, $tags="A");
|
||||
// attach(RIGHT, BOTTOM) cylinder(d=30, l=30, $tags="B");
|
||||
// }
|
||||
module hide(tags="")
|
||||
{
|
||||
$tags_hidden = tags==""? [] : str_split(tags, " ");
|
||||
$tags_shown = [];
|
||||
children();
|
||||
}
|
||||
|
||||
|
||||
// Module: show()
|
||||
// Usage:
|
||||
// show(tags) {...}
|
||||
// Topics: Attachments
|
||||
// See Also: tags(), recolor(), hide(), diff(), intersect()
|
||||
// Description:
|
||||
// Shows only children with the given tags. Overrides any previous `hide()` or `show()` calls.
|
||||
// For a more step-by-step explanation of attachments, see the [[Attachments Tutorial|Tutorial-Attachments]].
|
||||
// Example:
|
||||
// show("A B") cube(50, anchor=CENTER, $tags="Main") {
|
||||
// attach(LEFT, BOTTOM) cylinder(d=30, l=30, $tags="A");
|
||||
// attach(RIGHT, BOTTOM) cylinder(d=30, l=30, $tags="B");
|
||||
// }
|
||||
module show(tags="")
|
||||
{
|
||||
$tags_shown = tags==""? [] : str_split(tags, " ");
|
||||
$tags_hidden = [];
|
||||
children();
|
||||
}
|
||||
|
||||
|
||||
// Module: diff()
|
||||
|
@ -755,6 +696,67 @@ module hulling(a)
|
|||
}
|
||||
|
||||
|
||||
// Module: recolor()
|
||||
// Usage:
|
||||
// recolor(c) {...}
|
||||
// Topics: Attachments
|
||||
// See Also: tags(), hide(), show(), diff(), intersect()
|
||||
// Description:
|
||||
// Sets the color for children that can use the $color special variable. For a more step-by-step
|
||||
// explanation of attachments, see the [[Attachments Tutorial|Tutorial-Attachments]].
|
||||
// Arguments:
|
||||
// c = Color name or RGBA vector.
|
||||
// Example:
|
||||
// recolor("red") cyl(l=20, d=10);
|
||||
module recolor(c)
|
||||
{
|
||||
$color = c;
|
||||
children();
|
||||
}
|
||||
|
||||
|
||||
// Module: hide()
|
||||
// Usage:
|
||||
// hide(tags) {...}
|
||||
// Topics: Attachments
|
||||
// See Also: tags(), recolor(), show(), diff(), intersect()
|
||||
// Description:
|
||||
// Hides all children with the given tags. Overrides any previous `hide()` or `show()` calls.
|
||||
// For a more step-by-step explanation of attachments, see the [[Attachments Tutorial|Tutorial-Attachments]].
|
||||
// Example:
|
||||
// hide("A") cube(50, anchor=CENTER, $tags="Main") {
|
||||
// attach(LEFT, BOTTOM) cylinder(d=30, l=30, $tags="A");
|
||||
// attach(RIGHT, BOTTOM) cylinder(d=30, l=30, $tags="B");
|
||||
// }
|
||||
module hide(tags="")
|
||||
{
|
||||
$tags_hidden = tags==""? [] : str_split(tags, " ");
|
||||
$tags_shown = [];
|
||||
children();
|
||||
}
|
||||
|
||||
|
||||
// Module: show()
|
||||
// Usage:
|
||||
// show(tags) {...}
|
||||
// Topics: Attachments
|
||||
// See Also: tags(), recolor(), hide(), diff(), intersect()
|
||||
// Description:
|
||||
// Shows only children with the given tags. Overrides any previous `hide()` or `show()` calls.
|
||||
// For a more step-by-step explanation of attachments, see the [[Attachments Tutorial|Tutorial-Attachments]].
|
||||
// Example: Display the attachments but not the parent
|
||||
// show("A B") cube(50, anchor=CENTER, $tags="Main") {
|
||||
// attach(LEFT, BOTTOM) cylinder(d=30, l=30, $tags="A");
|
||||
// attach(RIGHT, BOTTOM) cylinder(d=30, l=30, $tags="B");
|
||||
// }
|
||||
module show(tags="")
|
||||
{
|
||||
$tags_shown = tags==""? [] : str_split(tags, " ");
|
||||
$tags_hidden = [];
|
||||
children();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Section: Attachable Masks
|
||||
|
||||
|
|
66
beziers.scad
66
beziers.scad
|
@ -44,24 +44,24 @@
|
|||
// u = Parameter values for evaluating the curve, given as a single value, a list or a range.
|
||||
// Example(2D): Quadratic (Degree 2) Bezier.
|
||||
// bez = [[0,0], [30,30], [80,0]];
|
||||
// trace_bezier(bez, N=len(bez)-1);
|
||||
// debug_bezier(bez, N=len(bez)-1);
|
||||
// translate(bezier_points(bez, 0.3)) color("red") sphere(1);
|
||||
// Example(2D): Cubic (Degree 3) Bezier
|
||||
// bez = [[0,0], [5,35], [60,-25], [80,0]];
|
||||
// trace_bezier(bez, N=len(bez)-1);
|
||||
// debug_bezier(bez, N=len(bez)-1);
|
||||
// translate(bezier_points(bez, 0.4)) color("red") sphere(1);
|
||||
// Example(2D): Degree 4 Bezier.
|
||||
// bez = [[0,0], [5,15], [40,20], [60,-15], [80,0]];
|
||||
// trace_bezier(bez, N=len(bez)-1);
|
||||
// debug_bezier(bez, N=len(bez)-1);
|
||||
// translate(bezier_points(bez, 0.8)) color("red") sphere(1);
|
||||
// Example(2D): Giving a List of `u`
|
||||
// bez = [[0,0], [5,35], [60,-25], [80,0]];
|
||||
// trace_bezier(bez, N=len(bez)-1);
|
||||
// debug_bezier(bez, N=len(bez)-1);
|
||||
// pts = bezier_points(bez, [0, 0.2, 0.3, 0.7, 0.8, 1]);
|
||||
// rainbow(pts) move($item) sphere(1.5, $fn=12);
|
||||
// Example(2D): Giving a Range of `u`
|
||||
// bez = [[0,0], [5,35], [60,-25], [80,0]];
|
||||
// trace_bezier(bez, N=len(bez)-1);
|
||||
// debug_bezier(bez, N=len(bez)-1);
|
||||
// pts = bezier_points(bez, [0:0.2:1]);
|
||||
// rainbow(pts) move($item) sphere(1.5, $fn=12);
|
||||
|
||||
|
@ -195,15 +195,15 @@ function _bezier_matrix(N) =
|
|||
// Example(2D): Quadratic (Degree 2) Bezier.
|
||||
// bez = [[0,0], [30,30], [80,0]];
|
||||
// move_copies(bezier_curve(bez, 8)) sphere(r=1.5, $fn=12);
|
||||
// trace_bezier(bez, N=len(bez)-1);
|
||||
// debug_bezier(bez, N=len(bez)-1);
|
||||
// Example(2D): Cubic (Degree 3) Bezier
|
||||
// bez = [[0,0], [5,35], [60,-25], [80,0]];
|
||||
// move_copies(bezier_curve(bez, 8)) sphere(r=1.5, $fn=12);
|
||||
// trace_bezier(bez, N=len(bez)-1);
|
||||
// debug_bezier(bez, N=len(bez)-1);
|
||||
// Example(2D): Degree 4 Bezier.
|
||||
// bez = [[0,0], [5,15], [40,20], [60,-15], [80,0]];
|
||||
// move_copies(bezier_curve(bez, 8)) sphere(r=1.5, $fn=12);
|
||||
// trace_bezier(bez, N=len(bez)-1);
|
||||
// debug_bezier(bez, N=len(bez)-1);
|
||||
function bezier_curve(bezier,n,endpoint=true) =
|
||||
bezier_points(bezier, lerpn(0,1,n,endpoint));
|
||||
|
||||
|
@ -299,7 +299,7 @@ function bezier_curvature(bezier, u) =
|
|||
// pt = [40,15];
|
||||
// bez = [[0,0], [20,40], [60,-25], [80,0]];
|
||||
// u = bezier_closest_point(bez, pt);
|
||||
// trace_bezier(bez, N=len(bez)-1);
|
||||
// debug_bezier(bez, N=len(bez)-1);
|
||||
// color("red") translate(pt) sphere(r=1);
|
||||
// color("blue") translate(bezier_points(bez,u)) sphere(r=1);
|
||||
function bezier_closest_point(bezier, pt, max_err=0.01, u=0, end_u=1) =
|
||||
|
@ -438,7 +438,7 @@ function bezpath_points(bezpath, seg, u, N=3) =
|
|||
// [60,25], [70,0], [80,-25],
|
||||
// [80,-50], [50,-50]
|
||||
// ];
|
||||
// trace_bezier(bez, N=3, width=2);
|
||||
// debug_bezier(bez, N=3, width=2);
|
||||
function bezpath_curve(bezpath, splinesteps=16, N=3, endpoint=true) =
|
||||
assert(is_path(bezpath))
|
||||
assert(is_int(N))
|
||||
|
@ -473,7 +473,7 @@ function bezpath_curve(bezpath, splinesteps=16, N=3, endpoint=true) =
|
|||
// [100,25], [140,25], [160,0]];
|
||||
// pos = bezpath_closest_point(bez, pt);
|
||||
// xy = bezpath_points(bez,pos[0],pos[1]);
|
||||
// trace_bezier(bez, N=3);
|
||||
// debug_bezier(bez, N=3);
|
||||
// color("red") translate(pt) sphere(r=1);
|
||||
// color("blue") translate(xy) sphere(r=1);
|
||||
function bezpath_closest_point(bezpath, pt, N=3, max_err=0.01, seg=0, min_seg=undef, min_u=undef, min_dist=undef) =
|
||||
|
@ -626,12 +626,12 @@ function path_to_bezpath(path, closed, tangents, uniform=false, size, relsize) =
|
|||
// bez = [[50,30], [40,10], [10,50], [0,30],
|
||||
// [-10, 10], [-30,10], [-50,20]];
|
||||
// closed = bezpath_close_to_axis(bez);
|
||||
// trace_bezier(closed);
|
||||
// debug_bezier(closed);
|
||||
// Example(2D):
|
||||
// bez = [[30,50], [10,40], [50,10], [30,0],
|
||||
// [10, -10], [10,-30], [20,-50]];
|
||||
// closed = bezpath_close_to_axis(bez, axis="Y");
|
||||
// trace_bezier(closed);
|
||||
// debug_bezier(closed);
|
||||
function bezpath_close_to_axis(bezpath, axis="X", N=3) =
|
||||
assert(is_path(bezpath,2), "bezpath_close_to_axis() can only work on 2D bezier paths.")
|
||||
assert(is_int(N))
|
||||
|
@ -668,11 +668,11 @@ function bezpath_close_to_axis(bezpath, axis="X", N=3) =
|
|||
// Example(2D):
|
||||
// bez = [[50,30], [40,10], [10,50], [0,30], [-10, 10], [-30,10], [-50,20]];
|
||||
// closed = bezpath_offset([0,-5], bez);
|
||||
// trace_bezier(closed);
|
||||
// debug_bezier(closed);
|
||||
// Example(2D):
|
||||
// bez = [[30,50], [10,40], [50,10], [30,0], [10, -10], [10,-30], [20,-50]];
|
||||
// closed = bezpath_offset([-5,0], bez);
|
||||
// trace_bezier(closed);
|
||||
// debug_bezier(closed);
|
||||
function bezpath_offset(offset, bezier, N=3) =
|
||||
assert(is_vector(offset,2))
|
||||
assert(is_path(bezier,2), "bezpath_offset() can only work on 2D bezier paths.")
|
||||
|
@ -712,7 +712,7 @@ function bezpath_offset(offset, bezier, N=3) =
|
|||
// bez_joint([ 20,-25], 135, 90, 10, 15),
|
||||
// bez_end ([ 50, 0], -90,20),
|
||||
// ]);
|
||||
// trace_bezier(bezpath);
|
||||
// debug_bezier(bezpath);
|
||||
// Example(2D): 2D Bezier Path by Vector
|
||||
// bezpath = flatten([
|
||||
// bez_begin([-50,0],[0,-20]),
|
||||
|
@ -720,7 +720,7 @@ function bezpath_offset(offset, bezier, N=3) =
|
|||
// bez_joint([ 20,-25], [-10,10], [0,15]),
|
||||
// bez_end ([ 50,0],[0, 20]),
|
||||
// ]);
|
||||
// trace_bezier(bezpath);
|
||||
// debug_bezier(bezpath);
|
||||
// Example(2D): 2D Bezier Path by Vector and Distance
|
||||
// bezpath = flatten([
|
||||
// bez_begin([-30,0],FWD, 30),
|
||||
|
@ -728,7 +728,7 @@ function bezpath_offset(offset, bezier, N=3) =
|
|||
// bez_joint([ 20,-25], 135, 90, 10, 15),
|
||||
// bez_end ([ 30,0],BACK,30),
|
||||
// ]);
|
||||
// trace_bezier(bezpath);
|
||||
// debug_bezier(bezpath);
|
||||
// Example(3D,FlatSpin,VPD=200): 3D Bezier Path by Angle
|
||||
// bezpath = flatten([
|
||||
// bez_begin([-30,0,0],90,20,p=135),
|
||||
|
@ -736,7 +736,7 @@ function bezpath_offset(offset, bezier, N=3) =
|
|||
// bez_joint([20,-25,0], 135, 90, 15, 10, p1=135, p2=45),
|
||||
// bez_end ([ 30,0,0],-90,20,p=45),
|
||||
// ]);
|
||||
// trace_bezier(bezpath);
|
||||
// debug_bezier(bezpath);
|
||||
// Example(3D,FlatSpin,VPD=225): 3D Bezier Path by Vector
|
||||
// bezpath = flatten([
|
||||
// bez_begin([-30,0,0],[0,-20, 20]),
|
||||
|
@ -744,7 +744,7 @@ function bezpath_offset(offset, bezier, N=3) =
|
|||
// bez_joint([20,-25,0],[0,10,-10],[0,15,15]),
|
||||
// bez_end ([ 30,0,0],[0,-20,-20]),
|
||||
// ]);
|
||||
// trace_bezier(bezpath);
|
||||
// debug_bezier(bezpath);
|
||||
// Example(3D,FlatSpin,VPD=225): 3D Bezier Path by Vector and Distance
|
||||
// bezpath = flatten([
|
||||
// bez_begin([-30,0,0],FWD, 20),
|
||||
|
@ -752,7 +752,7 @@ function bezpath_offset(offset, bezier, N=3) =
|
|||
// bez_joint([20,-25,0],LEFT,DOWN,r1=20,r2=15),
|
||||
// bez_end ([ 30,0,0],DOWN,20),
|
||||
// ]);
|
||||
// trace_bezier(bezpath);
|
||||
// debug_bezier(bezpath);
|
||||
function bez_begin(pt,a,r,p) =
|
||||
assert(is_finite(r) || is_vector(a))
|
||||
assert(len(pt)==3 || is_undef(p))
|
||||
|
@ -886,7 +886,7 @@ function bez_end(pt,a,r,p) =
|
|||
// [[-50,-16, 20], [-16,-16, 40], [ 16,-16, 40], [50,-16, 20]],
|
||||
// [[-50,-50, 0], [-16,-50, 20], [ 16,-50, 20], [50,-50, 0]]
|
||||
// ];
|
||||
// trace_bezier_patches(patches=[patch], size=1, showcps=true);
|
||||
// debug_bezier_patches(patches=[patch], size=1, showcps=true);
|
||||
// pt = bezier_patch_points(patch, 0.6, 0.75);
|
||||
// translate(pt) color("magenta") sphere(d=3, $fn=12);
|
||||
// Example(3D): Getting Multiple Points at Once
|
||||
|
@ -896,7 +896,7 @@ function bez_end(pt,a,r,p) =
|
|||
// [[-50,-16, 20], [-16,-16, 40], [ 16,-16, 40], [50,-16, 20]],
|
||||
// [[-50,-50, 0], [-16,-50, 20], [ 16,-50, 20], [50,-50, 0]]
|
||||
// ];
|
||||
// trace_bezier_patches(patches=[patch], size=1, showcps=true);
|
||||
// debug_bezier_patches(patches=[patch], size=1, showcps=true);
|
||||
// pts = bezier_patch_points(patch, [0:0.2:1], [0:0.2:1]);
|
||||
// for (row=pts) move_copies(row) color("magenta") sphere(d=3, $fn=12);
|
||||
function bezier_patch_points(patch, u, v) =
|
||||
|
@ -930,7 +930,7 @@ function bezier_patch_points(patch, u, v) =
|
|||
// [[0,-33,30], [25,16,30]],
|
||||
// [[50,-33,0]]
|
||||
// ];
|
||||
// trace_bezier_patches(patches=[tri], size=1, showcps=true);
|
||||
// debug_bezier_patches(patches=[tri], size=1, showcps=true);
|
||||
// pt = bezier_triangle_point(tri, 0.5, 0.2);
|
||||
// translate(pt) color("magenta") sphere(d=3, $fn=12);
|
||||
function bezier_triangle_point(tri, u, v) =
|
||||
|
@ -1336,7 +1336,7 @@ function _bezier_triangle(tri, splinesteps=16) =
|
|||
// trans = Amount to translate patch, after rotating to `orient`.
|
||||
// Example(3D):
|
||||
// patch = bezier_patch_flat(size=[100,100], N=3);
|
||||
// trace_bezier_patches([patch], size=1, showcps=true);
|
||||
// debug_bezier_patches([patch], size=1, showcps=true);
|
||||
function bezier_patch_flat(size=[100,100], N=4, spin=0, orient=UP, trans=[0,0,0]) =
|
||||
let(
|
||||
patch = [
|
||||
|
@ -1402,9 +1402,9 @@ function bezier_surface(patches=[], splinesteps=16, style="default") =
|
|||
// Section: Debugging Beziers
|
||||
|
||||
|
||||
// Module: trace_bezier()
|
||||
// Module: debug_bezier()
|
||||
// Usage:
|
||||
// trace_bezier(bez, [size], [N=]);
|
||||
// debug_bezier(bez, [size], [N=]);
|
||||
// Topics: Bezier Paths, Debugging
|
||||
// See Also: bezpath_curve()
|
||||
// Description:
|
||||
|
@ -1422,8 +1422,8 @@ function bezier_surface(patches=[], splinesteps=16, style="default") =
|
|||
// [ 14, -5], [ 15, 0], [16, 5],
|
||||
// [ 5, 10], [ 0, 10]
|
||||
// ];
|
||||
// trace_bezier(bez, N=3, width=0.5);
|
||||
module trace_bezier(bezpath, width=1, N=3) {
|
||||
// debug_bezier(bez, N=3, width=0.5);
|
||||
module debug_bezier(bezpath, width=1, N=3) {
|
||||
assert(is_path(bezpath));
|
||||
assert(is_int(N));
|
||||
assert(len(bezpath)%N == 1, str("A degree ",N," bezier path shound have a multiple of ",N," points in it, plus 1."));
|
||||
|
@ -1453,9 +1453,9 @@ module trace_bezier(bezpath, width=1, N=3) {
|
|||
}
|
||||
|
||||
|
||||
// Module: trace_bezier_patches()
|
||||
// Module: debug_bezier_patches()
|
||||
// Usage:
|
||||
// trace_bezier_patches(patches, [size=], [splinesteps=], [showcps=], [showdots=], [showpatch=], [convexity=], [style=]);
|
||||
// debug_bezier_patches(patches, [size=], [splinesteps=], [showcps=], [showdots=], [showpatch=], [convexity=], [style=]);
|
||||
// Topics: Bezier Patches, Debugging
|
||||
// See Also: bezier_patch_points(), bezier_patch_flat(), bezier_surface()
|
||||
// Description:
|
||||
|
@ -1483,8 +1483,8 @@ module trace_bezier(bezpath, width=1, N=3) {
|
|||
// [[ 0,33,0], [33, 33,-50], [ 67, 33,-50], [100, 33,0]],
|
||||
// [[15,15,0], [33, 0, 0], [ 67, 0, 0], [ 85, 15,0]],
|
||||
// ];
|
||||
// trace_bezier_patches(patches=[patch1, patch2], splinesteps=8, showcps=true);
|
||||
module trace_bezier_patches(patches=[], size, splinesteps=16, showcps=true, showdots=false, showpatch=true, convexity=10, style="default")
|
||||
// debug_bezier_patches(patches=[patch1, patch2], splinesteps=8, showcps=true);
|
||||
module debug_bezier_patches(patches=[], size, splinesteps=16, showcps=true, showdots=false, showpatch=true, convexity=10, style="default")
|
||||
{
|
||||
assert(is_undef(size)||is_num(size));
|
||||
assert(is_int(splinesteps) && splinesteps>0);
|
||||
|
|
|
@ -1803,21 +1803,21 @@ function point_in_polygon(point, poly, nonzero=false, eps=EPSILON) =
|
|||
// color("lightblue") for(tri=tris) polygon(select(poly,tri));
|
||||
// color("blue") up(1) for(tri=tris) { stroke(select(poly,tri),.15,closed=true); }
|
||||
// color("magenta") up(2) stroke(poly,.25,closed=true);
|
||||
// color("black") up(3) vnf_debug([path3d(poly),[]],faces=false,size=1);
|
||||
// color("black") up(3) debug_vnf([path3d(poly),[]],faces=false,size=1);
|
||||
// Example(2D,NoAxes): a polygon with a hole and one "contact" edge; see from above
|
||||
// poly = [ [-10,0], [10,0], [0,10], [-10,0], [-4,4], [4,4], [0,2], [-4,4] ];
|
||||
// tris = polygon_triangulate(poly);
|
||||
// color("lightblue") for(tri=tris) polygon(select(poly,tri));
|
||||
// color("blue") up(1) for(tri=tris) { stroke(select(poly,tri),.15,closed=true); }
|
||||
// color("magenta") up(2) stroke(poly,.25,closed=true);
|
||||
// color("black") up(3) vnf_debug([path3d(poly),[]],faces=false,size=1);
|
||||
// color("black") up(3) debug_vnf([path3d(poly),[]],faces=false,size=1);
|
||||
// Example(2D,NoAxes): a polygon with "touching" vertices and no holes; see from above
|
||||
// poly = [ [0,0], [5,5], [-5,5], [0,0], [-5,-5], [5,-5] ];
|
||||
// tris = polygon_triangulate(poly);
|
||||
// color("lightblue") for(tri=tris) polygon(select(poly,tri));
|
||||
// color("blue") up(1) for(tri=tris) { stroke(select(poly,tri),.15,closed=true); }
|
||||
// color("magenta") up(2) stroke(poly,.25,closed=true);
|
||||
// color("black") up(3) vnf_debug([path3d(poly),[]],faces=false,size=1);
|
||||
// color("black") up(3) debug_vnf([path3d(poly),[]],faces=false,size=1);
|
||||
// Example(2D,NoAxes): a polygon with "contact" edges and no holes; see from above
|
||||
// poly = [ [0,0], [10,0], [10,10], [0,10], [0,0], [3,3], [7,3],
|
||||
// [7,7], [7,3], [3,3] ];
|
||||
|
@ -1825,7 +1825,7 @@ function point_in_polygon(point, poly, nonzero=false, eps=EPSILON) =
|
|||
// color("lightblue") for(tri=tris) polygon(select(poly,tri));
|
||||
// color("blue") up(1) for(tri=tris) { stroke(select(poly,tri),.15,closed=true); }
|
||||
// color("magenta") up(2) stroke(poly,.25,closed=true);
|
||||
// color("black") up(3) vnf_debug([path3d(poly),[]],faces=false,size=1);
|
||||
// color("black") up(3) debug_vnf([path3d(poly),[]],faces=false,size=1);
|
||||
// Example(3D):
|
||||
// include <BOSL2/polyhedra.scad>
|
||||
// vnf = regular_polyhedron_info(name="dodecahedron",side=5,info="vnf");
|
||||
|
|
|
@ -1829,7 +1829,7 @@ module rounded_prism(bottom, top, joint_bot=0, joint_top=0, joint_sides=0, k_bot
|
|||
{
|
||||
if (debug){
|
||||
vnf_polyhedron(vnf, convexity=convexity);
|
||||
trace_bezier_patches(result[0], showcps=true, splinesteps=splinesteps, $fn=16, showdots=false, showpatch=false);
|
||||
debug_bezier_patches(result[0], showcps=true, splinesteps=splinesteps, $fn=16, showdots=false, showpatch=false);
|
||||
}
|
||||
else vnf_polyhedron(vnf,convexity=convexity);
|
||||
children();
|
||||
|
|
|
@ -1128,9 +1128,9 @@ function teardrop2d(r, ang=45, cap_h, d, anchor=CENTER, spin=0) =
|
|||
|
||||
// Function&Module: egg()
|
||||
// Usage: As Module
|
||||
// egg(length, r1, r2, R);
|
||||
// egg(length, r1|d1, r2|d2, R|D);
|
||||
// Usage: As Function
|
||||
// path = egg(length, r1|d2, r2|d2, R|D);
|
||||
// path = egg(length, r1|d1, r2|d2, R|D);
|
||||
// Topics: Shapes (2D), Paths (2D), Path Generators, Attachable
|
||||
// See Also: circle(), ellipse(), glued_circles()
|
||||
// Description:
|
||||
|
@ -1151,12 +1151,12 @@ function teardrop2d(r, ang=45, cap_h, d, anchor=CENTER, spin=0) =
|
|||
// Extra Anchors:
|
||||
// "left" = center of the left circle
|
||||
// "right" = center of the right circle
|
||||
// Example(2D,NoAxes): This first example shows how the egg is constructed from two circles and two joining arcs.
|
||||
// Example(2D): This first example shows how the egg is constructed from two circles and two joining arcs.
|
||||
// $fn=100;
|
||||
// color("red")stroke(egg(78,25,12, 60),closed=true);
|
||||
// stroke([left(14,circle(25)),
|
||||
// right(27,circle(12))]);
|
||||
// Examples(2D,NoAxes):
|
||||
// Examples(2D):
|
||||
// egg(78,25,12,50,$fn=64);
|
||||
// egg(78,25,12,60,$fn=64);
|
||||
// egg(78,25,12,85,$fs=0.1,$fa=1);
|
||||
|
|
8
vnf.scad
8
vnf.scad
|
@ -1240,9 +1240,9 @@ module _show_faces(vertices, faces, size=1) {
|
|||
|
||||
|
||||
|
||||
// Module: vnf_debug()
|
||||
// Module: debug_vnf()
|
||||
// Usage:
|
||||
// vnf_debug(vnfs, [faces], [vertices], [opacity], [size], [convexity]);
|
||||
// debug_vnf(vnfs, [faces], [vertices], [opacity], [size], [convexity]);
|
||||
// Description:
|
||||
// A drop-in module to replace `vnf_polyhedron()` to help debug vertices and faces.
|
||||
// Draws all the vertices at their 3D position, numbered in blue by their
|
||||
|
@ -1266,8 +1266,8 @@ module _show_faces(vertices, faces, size=1) {
|
|||
// Example(EdgesMed):
|
||||
// verts = [for (z=[-10,10], a=[0:120:359.9]) [10*cos(a),10*sin(a),z]];
|
||||
// faces = [[0,1,2], [5,4,3], [0,3,4], [0,4,1], [1,4,5], [1,5,2], [2,5,3], [2,3,0]];
|
||||
// vnf_debug([verts,faces], size=2);
|
||||
module vnf_debug(vnf, faces=true, vertices=true, opacity=0.5, size=1, convexity=6 ) {
|
||||
// debug_vnf([verts,faces], size=2);
|
||||
module debug_vnf(vnf, faces=true, vertices=true, opacity=0.5, size=1, convexity=6 ) {
|
||||
no_children($children);
|
||||
if (faces)
|
||||
_show_faces(vertices=vnf[0], faces=vnf[1], size=size);
|
||||
|
|
Loading…
Reference in a new issue