2020-05-20 17:11:06 +08:00
|
|
|
# vx_polygon
|
|
|
|
|
|
|
|
Returns points that can be used to draw a voxel-style polygon.
|
|
|
|
|
|
|
|
**Since:** 2.4
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
- `points` : A list of points. Each point can be `[x, y]`. x, y must be integer.
|
|
|
|
- `filled` : Default to `false`. Set it `true` if you want a filled polygon.
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
use <voxel/vx_polygon.scad>;
|
|
|
|
use <shape_pentagram.scad>;
|
|
|
|
|
|
|
|
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
|
|
|
];
|
|
|
|
|
|
|
|
for(pt = vx_polygon(pentagram)) {
|
|
|
|
translate(pt)
|
|
|
|
linear_extrude(1, scale = 0.5)
|
|
|
|
square(1, center = true);
|
|
|
|
}
|
|
|
|
|
|
|
|
translate([30, 0])
|
|
|
|
for(pt = vx_polygon(pentagram, filled = true)) {
|
|
|
|
translate(pt)
|
|
|
|
linear_extrude(1, scale = 0.5)
|
|
|
|
square(1, center = true);
|
|
|
|
}
|
|
|
|
|
2021-02-24 21:09:54 +08:00
|
|
|

|
2020-05-20 17:11:06 +08:00
|
|
|
|