fix closed=true stroke calls with endcaps given

This commit is contained in:
Adrian Mariano 2023-04-23 23:36:07 -04:00
parent 168ae7968e
commit 25aef90fc7
3 changed files with 20 additions and 20 deletions

View File

@ -103,7 +103,7 @@
// stroke(path, width=20);
// Example(2D): Closing a Path
// path = [[0,100], [100,100], [200,0], [100,-100], [100,0]];
// stroke(path, width=20, endcaps=true, closed=true);
// stroke(path, width=20, closed=true);
// Example(2D): Fancy Arrow Endcaps
// path = [[0,100], [100,100], [200,0], [100,-100], [100,0]];
// stroke(path, width=10, endcaps="arrow2");

View File

@ -149,43 +149,43 @@ BOSL2 will let you get the perimeter polygon for almost all of the standard 2D s
```openscad-2D
include <BOSL2/std.scad>
path = square(40, center=true);
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
```openscad-2D
include <BOSL2/std.scad>
path = rect([40,30], rounding=5);
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
```openscad-2D
include <BOSL2/std.scad>
path = trapezoid(w1=40, w2=20, h=30);
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
```openscad-2D
include <BOSL2/std.scad>
path = circle(d=50);
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
```openscad-2D
include <BOSL2/std.scad>
path = ellipse(d=[50,30]);
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
```openscad-2D
include <BOSL2/std.scad>
path = pentagon(d=50);
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
```openscad-2D
include <BOSL2/std.scad>
path = star(n=5, step=2, d=50);
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
### Arcs
@ -336,19 +336,19 @@ To translate a path, you can just pass it to the `move()` (or up/down/left/right
```openscad-2D
include <BOSL2/std.scad>
path = move([-15,-30], p=square(50,center=true));
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
```openscad-2D
include <BOSL2/std.scad>
path = fwd(30, p=square(50,center=true));
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
```openscad-2D
include <BOSL2/std.scad>
path = left(30, p=square(50,center=true));
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
To scale a path, you can just pass it to the `scale()` (or [xyz]scale) function in the `p=` argument:
@ -356,19 +356,19 @@ To scale a path, you can just pass it to the `scale()` (or [xyz]scale) function
```openscad-2D
include <BOSL2/std.scad>
path = scale([1.5,0.75], p=square(50,center=true));
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
```openscad-2D
include <BOSL2/std.scad>
path = xscale(1.5, p=square(50,center=true));
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
```openscad-2D
include <BOSL2/std.scad>
path = yscale(1.5, p=square(50,center=true));
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
To rotate a path, just can pass it to the `rot()` (or [xyz]rot) function in the `p=` argument:
@ -376,13 +376,13 @@ To rotate a path, just can pass it to the `rot()` (or [xyz]rot) function in the
```openscad-2D
include <BOSL2/std.scad>
path = rot(30, p=square(50,center=true));
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
```openscad-2D
include <BOSL2/std.scad>
path = zrot(30, p=square(50,center=true));
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
To mirror a path, just can pass it to the `mirror()` (or [xyz]flip) function in the `p=` argument:
@ -390,19 +390,19 @@ To mirror a path, just can pass it to the `mirror()` (or [xyz]flip) function in
```openscad-2D
include <BOSL2/std.scad>
path = mirror([1,1], p=trapezoid(w1=40, w2=10, h=25));
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
```openscad-2D
include <BOSL2/std.scad>
path = xflip(p=trapezoid(w1=40, w2=10, h=25));
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
```openscad-2D
include <BOSL2/std.scad>
path = yflip(p=trapezoid(w1=40, w2=10, h=25));
stroke(path, closed=true, endcap2="arrow2");
stroke(list_wrap(path), endcap2="arrow2");
```
You can get raw transformation matrices for various transformations by calling them like a function without a `p=` argument:

View File

@ -1872,7 +1872,7 @@ module vnf_validate(vnf, size=1, show_warns=true, check_isects=false, opacity=0.
color(clr) {
if (is_vector(pts[0])) {
if (len(pts)==2) {
stroke(pts, width=size, closed=true, endcaps="butt", $fn=8);
stroke(pts, width=size, endcaps="butt", $fn=8);
} else if (len(pts)>2) {
stroke(pts, width=size, closed=true, $fn=8);
polyhedron(pts,[[for (i=idx(pts)) i]]);