1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-29 11:58:39 +01:00

add closed param

This commit is contained in:
Justin Lin 2020-02-28 15:17:59 +08:00
parent 0ce3688981
commit fbbc0f0796
2 changed files with 6 additions and 5 deletions

View File

@ -46,5 +46,5 @@ module hollow_out_torus_knot(shape, p, q, phi_step, thickness, line_style) {
pts = torus_knot(p, q, phi_step);
sects = sects_by_path(shape, pts);
hollow_out_sweep(concat(sects, [sects[0]]), thickness, line_style);
hollow_out_sweep(sects, thickness, closed = true, style = line_style);
}

View File

@ -4,11 +4,11 @@ use <hull_polyline3d.scad>;
use <experimental/tri_bisectors.scad>;
// style: LINES or HULL_LINES
module hollow_out_sweep(sections, thickness, style = "LINES") {
module hollow_out_sweep(sections, thickness, closed = false, style = "LINES") {
function rects(sects) =
let(
sects_leng = len(sections),
shape_pt_leng = len(sections[0])
sects_leng = len(sects),
shape_pt_leng = len(sects[0])
)
[
for(i = [0:sects_leng - 2])
@ -29,8 +29,9 @@ module hollow_out_sweep(sections, thickness, style = "LINES") {
[[rect[0], rect[1], rect[2]], [rect[0], rect[2], rect[3]]] :
[[rect[1], rect[2], rect[3]], [rect[1], rect[3], rect[0]]];
sects = closed ? concat(sections, [sections[0]]) : sections;
lines = [
for(rect = rects(sections))
for(rect = rects(sects))
for(tri = rand_tris(rect))
each tri_bisectors(tri)
];