2020-05-20 17:11:06 +08:00
|
|
|
# vx_polyline
|
|
|
|
|
|
|
|
Given a list of points. `vx_polyline` returns points that can be used to draw a voxel-style polyline.
|
|
|
|
|
|
|
|
**Since:** 2.4
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
- `points` : A list of points. Each point can be `[x, y]` or `[x, y, z]`. x, y, z must be integer.
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
2022-06-06 13:11:46 +08:00
|
|
|
use <voxel/vx_polyline.scad>
|
|
|
|
use <shape_pentagram.scad>
|
2020-05-20 17:11:06 +08:00
|
|
|
|
|
|
|
pentagram = [
|
|
|
|
for(pt = shape_pentagram(15))
|
2021-12-04 12:16:20 +08:00
|
|
|
[round(pt.x), round(pt.y)]
|
2020-05-20 17:11:06 +08:00
|
|
|
];
|
|
|
|
|
2022-02-27 22:32:57 +08:00
|
|
|
for(pt = vx_polyline([each pentagram, pentagram[0]])) {
|
2020-05-20 17:11:06 +08:00
|
|
|
translate(pt)
|
2022-03-30 09:39:11 +08:00
|
|
|
linear_extrude(1, scale = 0.5)
|
|
|
|
square(1, center = true);
|
2020-05-20 17:11:06 +08:00
|
|
|
}
|
|
|
|
|
2021-02-24 21:09:54 +08:00
|
|
|
![vx_polyline](images/lib3x-vx_polyline-1.JPG)
|
2020-05-20 17:11:06 +08:00
|
|
|
|
2022-06-06 13:11:46 +08:00
|
|
|
use <voxel/vx_polyline.scad>
|
|
|
|
use <sphere_spiral.scad>
|
2020-05-20 17:11:06 +08:00
|
|
|
|
|
|
|
points_angles = sphere_spiral(
|
|
|
|
radius = 20,
|
|
|
|
za_step = 5
|
|
|
|
);
|
|
|
|
|
|
|
|
points = [
|
|
|
|
for(pa = points_angles)
|
|
|
|
let(pt = pa[0])
|
2021-12-04 12:16:20 +08:00
|
|
|
[round(pt.x), round(pt.y), round(pt.z)]
|
2020-05-20 17:11:06 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
for(a = [0:30:330]) {
|
|
|
|
rotate(a)
|
2022-03-30 09:39:11 +08:00
|
|
|
for(pt = vx_polyline(points)) {
|
|
|
|
translate(pt)
|
|
|
|
cube(1, center = true);
|
|
|
|
}
|
2020-05-20 17:11:06 +08:00
|
|
|
}
|
|
|
|
|
2021-02-24 21:09:54 +08:00
|
|
|
![vx_polyline](images/lib3x-vx_polyline-2.JPG)
|
2020-05-20 17:11:06 +08:00
|
|
|
|