mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-27 16:30:29 +02:00
use polyline_join
This commit is contained in:
@@ -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 <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <bezier_curve.scad>;
|
||||
|
||||
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);
|
||||
|
||||

|
||||
|
@@ -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 <hull_polyline2d.scad>;
|
||||
|
||||
$fn = 4;
|
||||
|
||||
hull_polyline2d(
|
||||
points = [[1, 2], [-5, -4], [-5, 3], [5, 5]],
|
||||
width = 1
|
||||
);
|
||||
|
||||

|
@@ -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.scad>;
|
||||
|
||||
hull_polyline3d(
|
||||
points = [
|
||||
[1, 2, 3],
|
||||
[4, -5, -6],
|
||||
[-1, -3, -5],
|
||||
[0, 0, 0]
|
||||
],
|
||||
diameter = 1,
|
||||
$fn = 3
|
||||
);
|
||||
|
||||

|
||||
|
||||
use <hull_polyline3d.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
@@ -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 <turtle/lsystem3.scad>;
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
|
||||
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 <turtle/lsystem3.scad>;
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
|
||||
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]) =
|
||||
|
@@ -12,14 +12,14 @@ Given a 2D path, this function constructs a mid-point smoothed version by joinin
|
||||
|
||||
## Examples
|
||||
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <shape_taiwan.scad>;
|
||||
use <midpt_smooth.scad>;
|
||||
|
||||
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);
|
||||
|
||||

|
@@ -14,13 +14,14 @@ Creates a hamiltonian path from a maze. The path is the result of maze traversal
|
||||
## Examples
|
||||
|
||||
use <maze/mz_hamiltonian.scad>;
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
|
||||
rows = 5;
|
||||
columns = 10;
|
||||
|
||||
path = mz_hamiltonian(rows, columns, [0, 0]);
|
||||
hull_polyline2d(path, .5);
|
||||
polyline_join(path)
|
||||
circle(.25);
|
||||
|
||||

|
||||
|
||||
|
@@ -17,7 +17,7 @@ It's a helper for creating wall data from maze cells. You can transform wall poi
|
||||
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_hex_walls.scad>;
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
@@ -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 <maze/mz_theta_cells.scad>;
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
@@ -13,7 +13,7 @@ It's a helper for getting data from a theta-maze cell.
|
||||
|
||||
use <maze/mz_theta_cells.scad>;
|
||||
use <maze/mz_theta_get.scad>;
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
@@ -11,13 +11,12 @@ Returns the 1D [Perlin noise](https://en.wikipedia.org/wiki/Perlin_noise) value
|
||||
|
||||
## Examples
|
||||
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <util/rand.scad>;
|
||||
use <noise/nz_perlin1.scad>;
|
||||
|
||||
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);
|
||||
|
||||

|
@@ -11,13 +11,14 @@ Returns 1D [Perlin noise](https://en.wikipedia.org/wiki/Perlin_noise) values at
|
||||
|
||||
## Examples
|
||||
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <noise/nz_perlin1s.scad>;
|
||||
|
||||
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);
|
||||
|
||||

|
@@ -13,7 +13,7 @@ Returns the 2D [Perlin noise](https://en.wikipedia.org/wiki/Perlin_noise) value
|
||||
## Examples
|
||||
|
||||
use <util/rand.scad>;
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <surface/sf_thicken.scad>;
|
||||
use <noise/nz_perlin2.scad>;
|
||||
use <contours.scad>;
|
||||
@@ -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);
|
||||
}
|
||||
|
||||

|
@@ -15,7 +15,7 @@ You can use any point as the first point of the edge path. Just remember that yo
|
||||
|
||||
## Examples
|
||||
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <shape_taiwan.scad>;
|
||||
use <path_scaling_sections.scad>;
|
||||
use <sweep.scad>;
|
||||
@@ -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));
|
||||
|
||||

|
||||
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <shape_taiwan.scad>;
|
||||
use <path_scaling_sections.scad>;
|
||||
use <sweep.scad>;
|
||||
@@ -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));
|
||||
|
||||

|
||||
@@ -99,7 +101,7 @@ You can use any point as the first point of the edge path. Just remember that yo
|
||||
|
||||

|
||||
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <shape_taiwan.scad>;
|
||||
use <path_scaling_sections.scad>;
|
||||
use <sweep.scad>;
|
||||
@@ -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));
|
||||
|
||||

|
@@ -11,7 +11,7 @@ You paths should be indexed count-clockwisely.
|
||||
## Examples
|
||||
|
||||
use <paths2sections.scad>;
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <sweep.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
||||
|
||||
use <bezier_curve.scad>;
|
||||
use <paths2sections.scad>;
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <sweep.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
||||
|
@@ -13,7 +13,7 @@ Transform a point inside a rectangle to a point inside a circle. You can use it
|
||||
|
||||
## Examples
|
||||
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <ptf/ptf_circle.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
||||
|
@@ -16,7 +16,7 @@ Transforms a point inside a rectangle to a point of a ring. It can create things
|
||||
|
||||
## Examples
|
||||
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <ptf/ptf_ring.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||

|
||||
|
@@ -16,7 +16,7 @@ Transforms a point inside a rectangle to a point of a torus. It can create thing
|
||||
|
||||
## Examples
|
||||
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <ptf/ptf_torus.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
||||
|
@@ -14,7 +14,7 @@ Twist a point along the x-axis. You can use it to create something such as a [tw
|
||||
|
||||
## Examples
|
||||
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <ptf/ptf_x_twist.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
||||
|
@@ -14,7 +14,7 @@ Twist a point along the y-axis. You can use it to create something such as a [tw
|
||||
|
||||
## Examples
|
||||
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <ptf/ptf_y_twist.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
||||
|
@@ -13,7 +13,7 @@ Rails should be indexed count-clockwisely.
|
||||
## Examples
|
||||
|
||||
use <rails2sections.scad>;
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <sweep.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
||||
|
||||
use <bezier_curve.scad>;
|
||||
use <rails2sections.scad>;
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <sweep.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
||||
|
@@ -20,7 +20,7 @@ Follow the steps described in [img2gray](https://github.com/JustinSDK/img2gray).
|
||||
|
||||
## Examples
|
||||
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <bezier_curve.scad>;
|
||||
use <surface/sf_curve.scad>;
|
||||
|
||||
@@ -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);
|
||||
#polyline_join(curve_path)
|
||||
sphere(2.5);
|
@@ -14,7 +14,7 @@ Creates all points and angles on the path of a spiral around a sphere. It return
|
||||
|
||||
## Examples
|
||||
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <sphere_spiral.scad>;
|
||||
|
||||
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
|
||||
|
||||

|
||||
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <sphere_spiral.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
||||
|
@@ -81,7 +81,7 @@ The code below creates the same drawing.
|
||||
|
||||

|
||||
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <turtle/t2d.scad>;
|
||||
|
||||
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) {
|
||||
|
@@ -20,7 +20,7 @@ For more details, please see [3D turtle graphics](https://openhome.cc/eGossip/Op
|
||||
## Examples
|
||||
|
||||
use <turtle/t3d.scad>;
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
|
||||
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);
|
||||
|
||||

|
||||
|
||||
|
@@ -12,7 +12,7 @@ Join a set of points to make a [Delaunay triangulation](https://en.wikipedia.org
|
||||
## Examples
|
||||
|
||||
use <triangle/tri_delaunay.scad>;
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
||||
|
@@ -14,7 +14,7 @@ A method of [`tri_delaunay`](lib3x-tri_delaunay.html). Returns the indices from
|
||||
use <triangle/tri_delaunay_indices.scad>;
|
||||
use <triangle/tri_delaunay_shapes.scad>;
|
||||
use <triangle/tri_delaunay_voronoi.scad>;
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
||||
|
@@ -14,7 +14,7 @@ A method of [`tri_delaunay`](lib3x-tri_delaunay.html). Returns triangle shapes f
|
||||
use <triangle/tri_delaunay_indices.scad>;
|
||||
use <triangle/tri_delaunay_shapes.scad>;
|
||||
use <triangle/tri_delaunay_voronoi.scad>;
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
||||
|
@@ -14,7 +14,7 @@ A method of [`tri_delaunay`](lib3x-tri_delaunay.html). Returns voronoi cells fro
|
||||
use <triangle/tri_delaunay_indices.scad>;
|
||||
use <triangle/tri_delaunay_shapes.scad>;
|
||||
use <triangle/tri_delaunay_voronoi.scad>;
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||

|
||||
|
@@ -13,7 +13,7 @@ Given a tangled-edge shape. This function trims the shape to a non-tangled shape
|
||||
|
||||
## Examples
|
||||
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <trim_shape.scad>;
|
||||
use <shape_taiwan.scad>;
|
||||
use <bijection_offset.scad>;
|
||||
@@ -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);
|
||||
|
||||

|
||||
|
||||
|
@@ -10,7 +10,7 @@ Create cell shapes of Voronoi from a list of points.
|
||||
|
||||
## Examples
|
||||
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <voronoi/vrn2_cells_from.scad>;
|
||||
|
||||
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)
|
||||
|
@@ -12,7 +12,7 @@ Create cell shapes of Voronoi in the first quadrant. You specify a space and a g
|
||||
|
||||
## Examples
|
||||
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <voronoi/vrn2_cells_space.scad>;
|
||||
|
||||
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
|
||||
|
||||

|
||||
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <ptf/ptf_torus.scad>;
|
||||
use <voronoi/vrn2_cells_space.scad>;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||

|
@@ -12,7 +12,7 @@ Draws a voxel-by-voxel curve from control points. The curve is drawn only from t
|
||||
## Examples
|
||||
|
||||
use <voxel/vx_curve.scad>;
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
|
||||
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);
|
||||
|
||||

|
||||
|
Reference in New Issue
Block a user