From 91d5c40336ad07d42a5992c0c218dd2530d65a21 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sat, 4 Dec 2021 10:57:29 +0800 Subject: [PATCH] use polyline_join --- docs/lib3x-bezier_curve.md | 11 +++---- docs/lib3x-hull_polyline2d.md | 22 -------------- docs/lib3x-hull_polyline3d.md | 45 ----------------------------- docs/lib3x-lsystem3.md | 18 ++++-------- docs/lib3x-midpt_smooth.md | 6 ++-- docs/lib3x-mz_hamiltonian.md | 5 ++-- docs/lib3x-mz_hex_walls.md | 5 ++-- docs/lib3x-mz_theta_cells.md | 11 ++++--- docs/lib3x-mz_theta_get.md | 11 ++++--- docs/lib3x-nz_perlin1.md | 7 ++--- docs/lib3x-nz_perlin1s.md | 5 ++-- docs/lib3x-nz_perlin2.md | 5 ++-- docs/lib3x-path_scaling_sections.md | 15 ++++++---- docs/lib3x-paths2sections.md | 10 ++++--- docs/lib3x-ptf_circle.md | 8 +++-- docs/lib3x-ptf_ring.md | 8 +++-- docs/lib3x-ptf_sphere.md | 4 +-- docs/lib3x-ptf_torus.md | 8 +++-- docs/lib3x-ptf_x_twist.md | 8 +++-- docs/lib3x-ptf_y_twist.md | 8 +++-- docs/lib3x-rails2sections.md | 10 ++++--- docs/lib3x-sf_curve.md | 5 ++-- docs/lib3x-sphere_spiral.md | 10 ++++--- docs/lib3x-t2d.md | 8 ++--- docs/lib3x-t3d.md | 9 +++--- docs/lib3x-tri_delaunay.md | 5 ++-- docs/lib3x-tri_delaunay_indices.md | 5 ++-- docs/lib3x-tri_delaunay_shapes.md | 5 ++-- docs/lib3x-tri_delaunay_voronoi.md | 5 ++-- docs/lib3x-trim_shape.md | 11 ++++--- docs/lib3x-vrn2_cells_from.md | 5 ++-- docs/lib3x-vrn2_cells_space.md | 10 ++++--- docs/lib3x-vx_curve.md | 5 ++-- 33 files changed, 139 insertions(+), 174 deletions(-) delete mode 100644 docs/lib3x-hull_polyline2d.md delete mode 100644 docs/lib3x-hull_polyline3d.md diff --git a/docs/lib3x-bezier_curve.md b/docs/lib3x-bezier_curve.md index 619580c1..743505fb 100644 --- a/docs/lib3x-bezier_curve.md +++ b/docs/lib3x-bezier_curve.md @@ -1,6 +1,6 @@ # bezier_curve -Given a set of control points, the `bezier_curve` function returns points of the Bézier path. Combined with the `polyline`, `polyline3d` or `hull_polyline3d` module defined in my library, you can create a Bézier curve. +Given a set of control points, the `bezier_curve` function returns points of the Bézier path. ## Parameters @@ -9,13 +9,13 @@ Given a set of control points, the `bezier_curve` function returns points of the ## Examples -If you have four control points and combine with the `hull_polyline3d` module: +If you have four control points: - use ; + use ; use ; t_step = 0.05; - width = 2; + radius = 2; p0 = [0, 0, 0]; p1 = [40, 60, 35]; @@ -26,6 +26,7 @@ If you have four control points and combine with the `hull_polyline3d` module: [p0, p1, p2, p3] ); - hull_polyline3d(points, width); + polyline_join(points) + sphere(radius); ![bezier_curve](images/lib3x-bezier_curve-1.JPG) diff --git a/docs/lib3x-hull_polyline2d.md b/docs/lib3x-hull_polyline2d.md deleted file mode 100644 index db6437c4..00000000 --- a/docs/lib3x-hull_polyline2d.md +++ /dev/null @@ -1,22 +0,0 @@ -# hull_polyline2d - -Creates a 2D polyline from a list of `[x, y]` coordinates. As the name says, it uses the built-in hull operation for each pair of points (created by the `circle` module). It's slow. However, it can be used to create metallic effects for a small `$fn`, large `$fa` or `$fs`. - -## Parameters - -- `points` : The list of `[x, y]` points of the polyline. The points are indexed from 0 to n-1. -- `width` : The line width. Default to 1. -- `$fa`, `$fs`, `$fn` : Check [the circle module](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#circle) for more details. - -## Examples - - use ; - - $fn = 4; - - hull_polyline2d( - points = [[1, 2], [-5, -4], [-5, 3], [5, 5]], - width = 1 - ); - -![hull_polyline3d](images/lib3x-hull_polyline2d-1.JPG) \ No newline at end of file diff --git a/docs/lib3x-hull_polyline3d.md b/docs/lib3x-hull_polyline3d.md deleted file mode 100644 index aff6ce3c..00000000 --- a/docs/lib3x-hull_polyline3d.md +++ /dev/null @@ -1,45 +0,0 @@ -# hull_polyline3d - -Creates a 3D polyline from a list of `[x, y, z]` coordinates. As the name says, it uses the built-in hull operation for each pair of points (created by the `sphere` module). It's slow. However, it can be used to create metallic effects for a small `$fn`, large `$fa` or `$fs`. - -## Parameters - -- `points` : The list of `[x, y, z]` points of the polyline. The points are indexed from 0 to n-1. -- `diameter` : The line diameter. Default to 1. -- `$fa`, `$fs`, `$fn` : Check [the sphere module](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids#sphere) for more details. - -## Examples - - use ; - - hull_polyline3d( - points = [ - [1, 2, 3], - [4, -5, -6], - [-1, -3, -5], - [0, 0, 0] - ], - diameter = 1, - $fn = 3 - ); - -![polyline3d](images/lib3x-hull_polyline3d-1.JPG) - - use ; - - r = 50; - points = [ - for(a = [0:180]) - [ - r * cos(-90 + a) * cos(a), - r * cos(-90 + a) * sin(a), - r * sin(-90 + a) - ] - ]; - - for(i = [0:7]) { - rotate(45 * i) - hull_polyline3d(points, 2, $fn = 3); - } - -![polyline3d](images/lib3x-hull_polyline3d-2.JPG) diff --git a/docs/lib3x-lsystem3.md b/docs/lib3x-lsystem3.md index ac5cc7a7..0d4ee445 100644 --- a/docs/lib3x-lsystem3.md +++ b/docs/lib3x-lsystem3.md @@ -33,14 +33,11 @@ [lsystem3-collections.scad](https://github.com/JustinSDK/dotSCAD/blob/master/examples/turtle/lsystem3_collection.scad) collects several L-system grammars. Here's one of them. use ; - use ; + use ; for(line = hilbert_curve()) { - hull_polyline3d( - [line[0], line[1]], - thickness = 0.5, - $fn = 4 - ); + polyline_join([line[0], line[1]]) + sphere(.25, $fn = 4); } function hilbert_curve(n = 3, angle = 90, leng = 1, heading = 0, start = [0, 0, 0]) = @@ -60,14 +57,11 @@ // a stochastic L-system use ; - use ; + use ; for(line = vine()) { - hull_polyline3d( - [line[0], line[1]], - thickness = 0.5, - $fn = 4 - ); + polyline_join([line[0], line[1]]) + sphere(.25, $fn = 4); } function vine(n = 3, angle = 18, leng = 1, heading = 0, start = [0, 0, 0]) = diff --git a/docs/lib3x-midpt_smooth.md b/docs/lib3x-midpt_smooth.md index 1c1f559d..27ba18aa 100644 --- a/docs/lib3x-midpt_smooth.md +++ b/docs/lib3x-midpt_smooth.md @@ -12,14 +12,14 @@ Given a 2D path, this function constructs a mid-point smoothed version by joinin ## Examples - use ; + use ; use ; use ; taiwan = shape_taiwan(50); smoothed = midpt_smooth(taiwan, 20, true); - translate([0, 0, 0]) hull_polyline2d(taiwan, .25); - #translate([10, 0, 0]) hull_polyline2d(smoothed, .25); + translate([0, 0, 0]) polyline_join(taiwan) circle(.125); + #translate([10, 0, 0]) polyline_join(smoothed) circle(.125); ![midpt_smooth](images/lib3x-midpt_smooth-1.JPG) \ No newline at end of file diff --git a/docs/lib3x-mz_hamiltonian.md b/docs/lib3x-mz_hamiltonian.md index 272c9137..d008481d 100644 --- a/docs/lib3x-mz_hamiltonian.md +++ b/docs/lib3x-mz_hamiltonian.md @@ -14,13 +14,14 @@ Creates a hamiltonian path from a maze. The path is the result of maze traversal ## Examples use ; - use ; + use ; rows = 5; columns = 10; path = mz_hamiltonian(rows, columns, [0, 0]); - hull_polyline2d(path, .5); + polyline_join(path) + circle(.25); ![mz_hamiltonian](images/lib3x-mz_hamiltonian-1.JPG) diff --git a/docs/lib3x-mz_hex_walls.md b/docs/lib3x-mz_hex_walls.md index 91f864aa..b2b14fc5 100644 --- a/docs/lib3x-mz_hex_walls.md +++ b/docs/lib3x-mz_hex_walls.md @@ -17,7 +17,7 @@ It's a helper for creating wall data from maze cells. You can transform wall poi use ; use ; - use ; + use ; rows = 10; columns = 12; @@ -28,7 +28,8 @@ It's a helper for creating wall data from maze cells. You can transform wall poi walls = mz_hex_walls(cells, rows, columns, cell_width); for(wall = walls) { - hull_polyline2d(wall, wall_thickness, $fn = 24); + polyline_join(wall) + circle(wall_thickness, $fn = 24); } ![mz_hex_walls](images/lib3x-mz_hex_walls-1.JPG) \ No newline at end of file diff --git a/docs/lib3x-mz_theta_cells.md b/docs/lib3x-mz_theta_cells.md index 4e526c2b..050d9e58 100644 --- a/docs/lib3x-mz_theta_cells.md +++ b/docs/lib3x-mz_theta_cells.md @@ -25,7 +25,7 @@ The value of `type` is the wall type of the cell. It can be `0`, `1`, `2` or `3` ## Examples use ; - use ; + use ; rows = 8; beginning_number = 8; @@ -58,11 +58,13 @@ The value of `type` is the wall type of the cell. It can be `0`, `1`, `2` or `3` outerVt2 = vt_from_angle(theta2, outerR); if(type == INWARD_WALL || type == INWARD_CCW_WALL) { - hull_polyline2d([innerVt1, innerVt2], width = wall_thickness); + polyline_join([innerVt1, innerVt2]) + circle(wall_thickness / 2); } if(type == CCW_WALL || type == INWARD_CCW_WALL) { - hull_polyline2d([innerVt2, outerVt2], width = wall_thickness); + polyline_join([innerVt1, innerVt2]) + circle(wall_thickness / 2); } } } @@ -73,7 +75,8 @@ The value of `type` is the wall type of the cell. It can be `0`, `1`, `2` or `3` for(theta = [0:thetaStep:360 - thetaStep]) { vt1 = vt_from_angle(theta, r); vt2 = vt_from_angle(theta + thetaStep, r); - hull_polyline2d([vt1, vt2], width = wall_thickness); + polyline_join([vt1, vt2]) + circle(wall_thickness / 2); } ![mz_theta_cells](images/lib3x-mz_theta_cells-3.JPG) \ No newline at end of file diff --git a/docs/lib3x-mz_theta_get.md b/docs/lib3x-mz_theta_get.md index 1104777b..b4e76869 100644 --- a/docs/lib3x-mz_theta_get.md +++ b/docs/lib3x-mz_theta_get.md @@ -13,7 +13,7 @@ It's a helper for getting data from a theta-maze cell. use ; use ; - use ; + use ; rows = 8; beginning_number = 8; @@ -39,11 +39,13 @@ It's a helper for getting data from a theta-maze cell. outerVt2 = vt_from_angle(theta2, outerR); if(type == "INWARD_WALL" || type == "INWARD_CCW_WALL") { - hull_polyline2d([innerVt1, innerVt2], width = wall_thickness); + polyline_join([innerVt1, innerVt2]) + circle(wall_thickness / 2); } if(type == "CCW_WALL" || type == "INWARD_CCW_WALL") { - hull_polyline2d([innerVt2, outerVt2], width = wall_thickness); + polyline_join([innerVt1, innerVt2]) + circle(wall_thickness / 2); } } } @@ -53,7 +55,8 @@ It's a helper for getting data from a theta-maze cell. for(theta = [0:thetaStep:360 - thetaStep]) { vt1 = vt_from_angle(theta, r); vt2 = vt_from_angle(theta + thetaStep, r); - hull_polyline2d([vt1, vt2], width = wall_thickness); + polyline_join([vt1, vt2]) + circle(wall_thickness / 2); } ![mz_theta_get](images/lib3x-mz_theta_get-1.JPG) \ No newline at end of file diff --git a/docs/lib3x-nz_perlin1.md b/docs/lib3x-nz_perlin1.md index 4a86ef48..716a7907 100644 --- a/docs/lib3x-nz_perlin1.md +++ b/docs/lib3x-nz_perlin1.md @@ -11,13 +11,12 @@ Returns the 1D [Perlin noise](https://en.wikipedia.org/wiki/Perlin_noise) value ## Examples - use ; + use ; use ; use ; seed = rand(); - hull_polyline2d( - [for(x = [0:.1:10]) [x, nz_perlin1(x, seed)]], width = .1 - ); + polyline_join([for(x = [0:.1:10]) [x, nz_perlin1(x, seed)]]) + circle(.05); ![nz_perlin1](images/lib3x-nz_perlin1-1.JPG) \ No newline at end of file diff --git a/docs/lib3x-nz_perlin1s.md b/docs/lib3x-nz_perlin1s.md index 41ce225e..60013dab 100644 --- a/docs/lib3x-nz_perlin1s.md +++ b/docs/lib3x-nz_perlin1s.md @@ -11,13 +11,14 @@ Returns 1D [Perlin noise](https://en.wikipedia.org/wiki/Perlin_noise) values at ## Examples - use ; + use ; use ; xs = [for(x = [0:.1:10]) x]; ys = nz_perlin1s(xs); points = [for(i = [0:len(xs) - 1]) [xs[i], ys[i]]]; - hull_polyline2d(points, width = .1); + polyline_join(points) + circle(.05); ![nz_perlin1s](images/lib3x-nz_perlin1s-1.JPG) \ No newline at end of file diff --git a/docs/lib3x-nz_perlin2.md b/docs/lib3x-nz_perlin2.md index f49fec23..b1056782 100644 --- a/docs/lib3x-nz_perlin2.md +++ b/docs/lib3x-nz_perlin2.md @@ -13,7 +13,7 @@ Returns the 2D [Perlin noise](https://en.wikipedia.org/wiki/Perlin_noise) value ## Examples use ; - use ; + use ; use ; use ; use ; @@ -31,7 +31,8 @@ Returns the 2D [Perlin noise](https://en.wikipedia.org/wiki/Perlin_noise) value translate([11, 0]) for(isoline = contours(points, 0)) { - hull_polyline2d(isoline, width = .1); + polyline_join(isoline) + circle(.05); } ![nz_perlin2](images/lib3x-nz_perlin2-1.JPG) \ No newline at end of file diff --git a/docs/lib3x-path_scaling_sections.md b/docs/lib3x-path_scaling_sections.md index 420c712e..59b9d3ce 100644 --- a/docs/lib3x-path_scaling_sections.md +++ b/docs/lib3x-path_scaling_sections.md @@ -15,7 +15,7 @@ You can use any point as the first point of the edge path. Just remember that yo ## Examples - use ; + use ; use ; use ; use ; @@ -33,12 +33,13 @@ You can use any point as the first point of the edge path. Just remember that yo fst_pt + [0, 0, 60] ]; - #hull_polyline3d(edge_path); + #polyline_join(edge_path) + sphere(.5); sweep(path_scaling_sections(taiwan, edge_path)); ![path_scaling_sections](images/lib3x-path_scaling_sections-1.JPG) - use ; + use ; use ; use ; use ; @@ -58,7 +59,8 @@ You can use any point as the first point of the edge path. Just remember that yo fst_pt + [0, 0, 60] ]); - #hull_polyline3d(edge_path); + #polyline_join(edge_path) + sphere(.5); sweep(path_scaling_sections(taiwan, edge_path)); ![path_scaling_sections](images/lib3x-path_scaling_sections-2.JPG) @@ -99,7 +101,7 @@ You can use any point as the first point of the edge path. Just remember that yo ![path_scaling_sections](images/lib3x-path_scaling_sections-3.JPG) - use ; + use ; use ; use ; use ; @@ -123,7 +125,8 @@ You can use any point as the first point of the edge path. Just remember that yo fst_pt + ptf_rotate([0, 0, 60], a) ]; - #hull_polyline3d(edge_path); + #polyline_join(edge_path) + sphere(.5); sweep(path_scaling_sections(taiwan, edge_path)); ![path_scaling_sections](images/lib3x-path_scaling_sections-4.JPG) \ No newline at end of file diff --git a/docs/lib3x-paths2sections.md b/docs/lib3x-paths2sections.md index fd379fb1..266ca784 100644 --- a/docs/lib3x-paths2sections.md +++ b/docs/lib3x-paths2sections.md @@ -11,7 +11,7 @@ You paths should be indexed count-clockwisely. ## Examples use ; - use ; + use ; use ; paths = [ @@ -26,14 +26,15 @@ You paths should be indexed count-clockwisely. sweep(sections); #for(path = paths) { - hull_polyline3d(path, 0.5); + polyline_join(path) + sphere(.25); } ![paths2sections](images/lib3x-paths2sections-1.JPG) use ; use ; - use ; + use ; use ; t_step = 0.05; @@ -59,7 +60,8 @@ You paths should be indexed count-clockwisely. sweep(sections); #for(path = paths) { - hull_polyline3d(path, 0.5); + polyline_join(path) + sphere(.25); } ![paths2sections](images/lib3x-paths2sections-2.JPG) diff --git a/docs/lib3x-ptf_circle.md b/docs/lib3x-ptf_circle.md index b9a898e0..d61a9166 100644 --- a/docs/lib3x-ptf_circle.md +++ b/docs/lib3x-ptf_circle.md @@ -13,7 +13,7 @@ Transform a point inside a rectangle to a point inside a circle. You can use it ## Examples - use ; + use ; use ; size = [10, 10]; @@ -30,12 +30,14 @@ Transform a point inside a rectangle to a point inside a circle. You can use it for(line = rows) { transformed = [for(p = line) ptf_circle(size, p)]; - hull_polyline3d(transformed, thickness = .1); + polyline_join(transformed) + sphere(.05); } for(line = columns) { transformed = [for(p = line) ptf_circle(size, p)]; - hull_polyline3d(transformed, thickness = .1); + polyline_join(transformed) + sphere(.05); } ![ptf_circle](images/lib3x-ptf_circle-2.JPG) diff --git a/docs/lib3x-ptf_ring.md b/docs/lib3x-ptf_ring.md index c2706872..993c8e6f 100644 --- a/docs/lib3x-ptf_ring.md +++ b/docs/lib3x-ptf_ring.md @@ -16,7 +16,7 @@ Transforms a point inside a rectangle to a point of a ring. It can create things ## Examples - use ; + use ; use ; size = [20, 10]; @@ -34,12 +34,14 @@ Transforms a point inside a rectangle to a point of a ring. It can create things for(line = rows) { transformed = [for(p = line) ptf_ring(size, p, radius, 360, 180)]; - hull_polyline3d(transformed, thickness = .5); + polyline_join(transformed) + sphere(.25); } for(line = columns) { transformed = [for(p = line) ptf_ring(size, p, radius, 360, 180)]; - hull_polyline3d(transformed, thickness = .5); + polyline_join(transformed) + sphere(.25); } ![ptf_ring](images/lib3x-ptf_ring-2.JPG) diff --git a/docs/lib3x-ptf_sphere.md b/docs/lib3x-ptf_sphere.md index d1293f48..5a18b4dd 100644 --- a/docs/lib3x-ptf_sphere.md +++ b/docs/lib3x-ptf_sphere.md @@ -35,13 +35,13 @@ Transforms a point inside a rectangle to a point of a sphere. It can create thin for(line = rows) { transformed = [for(p = line) ptf_sphere(size, p, radius, angle)]; polyline_join(transformed) - sphere(.5); + sphere(.25); } for(line = columns) { transformed = [for(p = line) ptf_sphere(size, p, radius, angle)]; polyline_join(transformed) - sphere(.5); + sphere(.25); } ![ptf_sphere](images/lib3x-ptf_sphere-2.JPG) diff --git a/docs/lib3x-ptf_torus.md b/docs/lib3x-ptf_torus.md index 5e394211..f7054ff1 100644 --- a/docs/lib3x-ptf_torus.md +++ b/docs/lib3x-ptf_torus.md @@ -16,7 +16,7 @@ Transforms a point inside a rectangle to a point of a torus. It can create thing ## Examples - use ; + use ; use ; size = [20, 10]; @@ -36,12 +36,14 @@ Transforms a point inside a rectangle to a point of a torus. It can create thing for(line = rows) { transformed = [for(p = line) ptf_torus(size, p, radius, angle, twist)]; - hull_polyline3d(transformed, thickness = .5); + polyline_join(transformed) + sphere(.25); } for(line = columns) { transformed = [for(p = line) ptf_torus(size, p, radius, angle, twist)]; - hull_polyline3d(transformed, thickness = .5); + polyline_join(transformed) + sphere(.25); } ![ptf_torus](images/lib3x-ptf_torus-2.JPG) diff --git a/docs/lib3x-ptf_x_twist.md b/docs/lib3x-ptf_x_twist.md index 7b82af34..964a9535 100644 --- a/docs/lib3x-ptf_x_twist.md +++ b/docs/lib3x-ptf_x_twist.md @@ -14,7 +14,7 @@ Twist a point along the x-axis. You can use it to create something such as a [tw ## Examples - use ; + use ; use ; size = [20, 10]; @@ -31,12 +31,14 @@ Twist a point along the x-axis. You can use it to create something such as a [tw for(line = rows) { twisted = [for(p = line) ptf_x_twist(size, p, 90)]; - hull_polyline3d(twisted, thickness = .1); + polyline_join(twisted) + sphere(.05); } for(line = columns) { twisted = [for(p = line) ptf_x_twist(size, p, 90)]; - hull_polyline3d(twisted, thickness = .1); + polyline_join(twisted) + sphere(.05); } ![ptf_x_twist](images/lib3x-ptf_x_twist-1.JPG) diff --git a/docs/lib3x-ptf_y_twist.md b/docs/lib3x-ptf_y_twist.md index 031249e2..b2ef1318 100644 --- a/docs/lib3x-ptf_y_twist.md +++ b/docs/lib3x-ptf_y_twist.md @@ -14,7 +14,7 @@ Twist a point along the y-axis. You can use it to create something such as a [tw ## Examples - use ; + use ; use ; size = [10, 20]; @@ -31,12 +31,14 @@ Twist a point along the y-axis. You can use it to create something such as a [tw for(line = rows) { twisted = [for(p = line) ptf_y_twist(size, p, 90)]; - hull_polyline3d(twisted, thickness = .1); + polyline_join(twisted) + sphere(.05); } for(line = columns) { twisted = [for(p = line) ptf_y_twist(size, p, 90)]; - hull_polyline3d(twisted, thickness = .1); + polyline_join(twisted) + sphere(.05); } ![ptf_y_twist](images/lib3x-ptf_y_twist-1.JPG) diff --git a/docs/lib3x-rails2sections.md b/docs/lib3x-rails2sections.md index 910c115c..ea0315a6 100644 --- a/docs/lib3x-rails2sections.md +++ b/docs/lib3x-rails2sections.md @@ -13,7 +13,7 @@ Rails should be indexed count-clockwisely. ## Examples use ; - use ; + use ; use ; rails = [ @@ -28,14 +28,15 @@ Rails should be indexed count-clockwisely. sweep(sections); #for(path = rails) { - hull_polyline3d(path, 0.5); + polyline_join(path) + sphere(.25); } ![rails2sections](images/lib3x-rails2sections-1.JPG) use ; use ; - use ; + use ; use ; t_step = 0.05; @@ -61,7 +62,8 @@ Rails should be indexed count-clockwisely. sweep(sections); #for(path = rails) { - hull_polyline3d(path, 0.5); + polyline_join(path) + sphere(.25); } ![rails2sections](images/lib3x-rails2sections-2.JPG) diff --git a/docs/lib3x-sf_curve.md b/docs/lib3x-sf_curve.md index 89e2dac6..1463ab98 100644 --- a/docs/lib3x-sf_curve.md +++ b/docs/lib3x-sf_curve.md @@ -20,7 +20,7 @@ Follow the steps described in [img2gray](https://github.com/JustinSDK/img2gray). ## Examples - use ; + use ; use ; use ; @@ -146,4 +146,5 @@ Follow the steps described in [img2gray](https://github.com/JustinSDK/img2gray). sf_curve(levels, curve_path, thickness, depth, invert); - #hull_polyline3d(curve_path, 5); \ No newline at end of file + #polyline_join(curve_path) + sphere(2.5); \ No newline at end of file diff --git a/docs/lib3x-sphere_spiral.md b/docs/lib3x-sphere_spiral.md index 15fe6bb7..b70f3996 100644 --- a/docs/lib3x-sphere_spiral.md +++ b/docs/lib3x-sphere_spiral.md @@ -14,7 +14,7 @@ Creates all points and angles on the path of a spiral around a sphere. It return ## Examples - use ; + use ; use ; points_angles = sphere_spiral( @@ -25,7 +25,8 @@ Creates all points and angles on the path of a spiral around a sphere. It return end_angle = 90 ); - hull_polyline3d([for(pa = points_angles) pa[0]], 1); + polyline_join([for(pa = points_angles) pa[0]]) + sphere(.5); %sphere(40); @@ -54,7 +55,7 @@ Creates all points and angles on the path of a spiral around a sphere. It return ![sphere_spiral](images/lib3x-sphere_spiral-5.JPG) - use ; + use ; use ; points_angles = sphere_spiral( @@ -64,7 +65,8 @@ Creates all points and angles on the path of a spiral around a sphere. It return for(a = [0:30:360]) { rotate(a) - hull_polyline3d([for(pa = points_angles) pa[0]], 2); + polyline_join([for(pa = points_angles) pa[0]]) + sphere(1); } ![sphere_spiral](images/lib3x-sphere_spiral-6.JPG) diff --git a/docs/lib3x-t2d.md b/docs/lib3x-t2d.md index adafac80..234449c4 100644 --- a/docs/lib3x-t2d.md +++ b/docs/lib3x-t2d.md @@ -81,7 +81,7 @@ The code below creates the same drawing. ![t2d](images/lib3x-t2d-1.JPG) - use ; + use ; use ; side_leng = 100; @@ -100,10 +100,8 @@ The code below creates the same drawing. ["forward", side_leng] ]); - hull_polyline2d( - [for(turtle = [t, t2, t3, t]) t2d(turtle, "point")], - thickness - ); + polyline_join([for(turtle = [t, t2, t3, t]) t2d(turtle, "point")]) + circle(thickness / 2); } module sierpinski_triangle(t, side_leng, min_leng, thickness) { diff --git a/docs/lib3x-t3d.md b/docs/lib3x-t3d.md index 27e24711..5e82d298 100644 --- a/docs/lib3x-t3d.md +++ b/docs/lib3x-t3d.md @@ -20,7 +20,7 @@ For more details, please see [3D turtle graphics](https://openhome.cc/eGossip/Op ## Examples use ; - use ; + use ; leng = 10; angle = 120; @@ -37,10 +37,9 @@ For more details, please see [3D turtle graphics](https://openhome.cc/eGossip/Op ["xforward", leng] ]); - hull_polyline3d( - [for(turtle = [t, t2, t3, t4]) t3d(turtle, "point")], - thickness - ); + polyline_join( + [for(turtle = [t, t2, t3, t4]) t3d(turtle, "point")] + ) sphere(thickness / 2); ![t3d](images/lib3x-t3d-1.JPG) diff --git a/docs/lib3x-tri_delaunay.md b/docs/lib3x-tri_delaunay.md index 3621e983..f7fe0fb9 100644 --- a/docs/lib3x-tri_delaunay.md +++ b/docs/lib3x-tri_delaunay.md @@ -12,7 +12,7 @@ Join a set of points to make a [Delaunay triangulation](https://en.wikipedia.org ## Examples use ; - use ; + use ; points = [for(i = [0:20]) rands(-100, 100, 2)]; @@ -32,7 +32,8 @@ Join a set of points to make a [Delaunay triangulation](https://en.wikipedia.org color("red") linear_extrude(3) for(t = tri_delaunay(points, ret = "VORONOI_CELLS")) { - hull_polyline2d(concat(t, [t[0]]), 2); + polyline_join(concat(t, [t[0]])) + circle(1); } ![tri_delaunay](images/lib3x-tri_delaunay-1.JPG) diff --git a/docs/lib3x-tri_delaunay_indices.md b/docs/lib3x-tri_delaunay_indices.md index 6c722f10..d9a0a352 100644 --- a/docs/lib3x-tri_delaunay_indices.md +++ b/docs/lib3x-tri_delaunay_indices.md @@ -14,7 +14,7 @@ A method of [`tri_delaunay`](lib3x-tri_delaunay.html). Returns the indices from use ; use ; use ; - use ; + use ; points = [for(i = [0:20]) rands(-100, 100, 2)]; @@ -36,7 +36,8 @@ A method of [`tri_delaunay`](lib3x-tri_delaunay.html). Returns the indices from color("red") linear_extrude(3) for(t = tri_delaunay_voronoi(delaunay)) { - hull_polyline2d(concat(t, [t[0]]), 2); + polyline_join(concat(t, [t[0]])) + circle(1); } ![tri_delaunay_indices](images/lib3x-tri_delaunay_indices-1.JPG) diff --git a/docs/lib3x-tri_delaunay_shapes.md b/docs/lib3x-tri_delaunay_shapes.md index d361990a..2c3d661c 100644 --- a/docs/lib3x-tri_delaunay_shapes.md +++ b/docs/lib3x-tri_delaunay_shapes.md @@ -14,7 +14,7 @@ A method of [`tri_delaunay`](lib3x-tri_delaunay.html). Returns triangle shapes f use ; use ; use ; - use ; + use ; points = [for(i = [0:20]) rands(-100, 100, 2)]; @@ -36,7 +36,8 @@ A method of [`tri_delaunay`](lib3x-tri_delaunay.html). Returns triangle shapes f color("red") linear_extrude(3) for(t = tri_delaunay_voronoi(delaunay)) { - hull_polyline2d(concat(t, [t[0]]), 2); + polyline_join(concat(t, [t[0]])) + circle(1); } ![tri_delaunay_shapes](images/lib3x-tri_delaunay_shapes-1.JPG) diff --git a/docs/lib3x-tri_delaunay_voronoi.md b/docs/lib3x-tri_delaunay_voronoi.md index a0ad3ed5..a8bc529f 100644 --- a/docs/lib3x-tri_delaunay_voronoi.md +++ b/docs/lib3x-tri_delaunay_voronoi.md @@ -14,7 +14,7 @@ A method of [`tri_delaunay`](lib3x-tri_delaunay.html). Returns voronoi cells fro use ; use ; use ; - use ; + use ; points = [for(i = [0:20]) rands(-100, 100, 2)]; @@ -36,7 +36,8 @@ A method of [`tri_delaunay`](lib3x-tri_delaunay.html). Returns voronoi cells fro color("red") linear_extrude(3) for(t = tri_delaunay_voronoi(delaunay)) { - hull_polyline2d(concat(t, [t[0]]), 2); + polyline_join(concat(t, [t[0]])) + circle(1); } ![tri_delaunay_voronoi](images/lib3x-tri_delaunay_voronoi-1.JPG) diff --git a/docs/lib3x-trim_shape.md b/docs/lib3x-trim_shape.md index 8e01c605..53291f74 100644 --- a/docs/lib3x-trim_shape.md +++ b/docs/lib3x-trim_shape.md @@ -13,7 +13,7 @@ Given a tangled-edge shape. This function trims the shape to a non-tangled shape ## Examples - use ; + use ; use ; use ; use ; @@ -24,10 +24,13 @@ Given a tangled-edge shape. This function trims the shape to a non-tangled shape trimmed = trim_shape(offseted, 3, len(offseted) - 6); smoothed = midpt_smooth(trimmed, 3); - #hull_polyline2d(taiwan, .1); + #polyline_join(taiwan) + circle(.05); %translate([25, 0, 0]) - hull_polyline2d(offseted, .2); - hull_polyline2d(smoothed, .1); + polyline_join(offseted) + circle(.1); + polyline_join(smoothed) + circle(.05); ![trim_shape](images/lib3x-trim_shape-1.JPG) diff --git a/docs/lib3x-vrn2_cells_from.md b/docs/lib3x-vrn2_cells_from.md index 797eb3ac..3d12e9f9 100644 --- a/docs/lib3x-vrn2_cells_from.md +++ b/docs/lib3x-vrn2_cells_from.md @@ -10,7 +10,7 @@ Create cell shapes of Voronoi from a list of points. ## Examples - use ; + use ; use ; points = [for(i = [0:50]) rands(-100, 100, 2)]; @@ -21,7 +21,8 @@ Create cell shapes of Voronoi from a list of points. cell = cells[i]; linear_extrude(1) - hull_polyline2d(concat(cell, [cell[0]]), width = 1); + polyline_join(concat(cell, [cell[0]])) + circle(.5); color(rands(0, 1, 3)) translate(pt) diff --git a/docs/lib3x-vrn2_cells_space.md b/docs/lib3x-vrn2_cells_space.md index e30913e1..a7af3bde 100644 --- a/docs/lib3x-vrn2_cells_space.md +++ b/docs/lib3x-vrn2_cells_space.md @@ -12,7 +12,7 @@ Create cell shapes of Voronoi in the first quadrant. You specify a space and a g ## Examples - use ; + use ; use ; size = [20, 20]; @@ -24,7 +24,8 @@ Create cell shapes of Voronoi in the first quadrant. You specify a space and a g cell_poly = cell[1]; linear_extrude(1) - hull_polyline2d(concat(cell_poly, [cell_poly[0]]), width = 1); + polyline_join(concat(cell_poly, [cell_poly[0]])) + circle(.5); color(rands(0, 1, 3)) translate(cell_pt) @@ -35,7 +36,7 @@ Create cell shapes of Voronoi in the first quadrant. You specify a space and a g ![vrn2_cells_space](images/lib3x-vrn2_cells_space-1.JPG) - use ; + use ; use ; use ; @@ -48,7 +49,8 @@ Create cell shapes of Voronoi in the first quadrant. You specify a space and a g for(cell = cells) { cell_poly = [for(p = cell[1]) ptf_torus(size, p, [10, 5], [360, 360])]; - hull_polyline3d(cell_poly, thickness = 1); + polyline_join(cell_poly) + sphere(.5); } ![vrn2_cells_space](images/lib3x-vrn2_cells_space-2.JPG) \ No newline at end of file diff --git a/docs/lib3x-vx_curve.md b/docs/lib3x-vx_curve.md index b3f52fe4..ffaea666 100644 --- a/docs/lib3x-vx_curve.md +++ b/docs/lib3x-vx_curve.md @@ -12,7 +12,7 @@ Draws a voxel-by-voxel curve from control points. The curve is drawn only from t ## Examples use ; - use ; + use ; pts = [ [28, 2, 1], @@ -32,6 +32,7 @@ Draws a voxel-by-voxel curve from control points. The curve is drawn only from t translate(pt) sphere(1); } - #hull_polyline3d(pts, .1); + #polyline_join(pts) + sphere(.05); ![vx_curve](images/lib3x-vx_curve-1.JPG)