mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 16:29:40 +00:00
Change to allow roundings that fully occupy segment with deduplicate
This commit is contained in:
parent
ff1ff2d2b6
commit
fe9a9a5d01
1 changed files with 5 additions and 5 deletions
|
@ -54,8 +54,7 @@ include <structs.scad>
|
||||||
// If you select curves that are too large to fit the function will fail with an error. You can set `verbose=true` to
|
// If you select curves that are too large to fit the function will fail with an error. You can set `verbose=true` to
|
||||||
// get a message showing a list of scale factors you can apply to your rounding parameters so that the
|
// get a message showing a list of scale factors you can apply to your rounding parameters so that the
|
||||||
// roundovers will fit on the curve. If the scale factors are larger than one
|
// roundovers will fit on the curve. If the scale factors are larger than one
|
||||||
// then they indicate how much you can increase the curve sizes before collisions will occur. Note that for roundings
|
// then they indicate how much you can increase the curve sizes before collisions will occur.
|
||||||
// to fit, you must leave space between them, so you you cannot round a length 10 segment with radius 5 roundings at each end.
|
|
||||||
// .
|
// .
|
||||||
// The parameters `radius`, `cut`, `joint` and `k` can be numbers, which round every corner using the same parameters, or you
|
// The parameters `radius`, `cut`, `joint` and `k` can be numbers, which round every corner using the same parameters, or you
|
||||||
// can specify a list to round each corner with different parameters. If the curve is not closed then the first and last points
|
// can specify a list to round each corner with different parameters. If the curve is not closed then the first and last points
|
||||||
|
@ -293,14 +292,15 @@ function round_corners(path, method="circle", radius, cut, joint, k, closed=true
|
||||||
],
|
],
|
||||||
dummy = verbose ? echo("Roundover scale factors:",scalefactors) : 0
|
dummy = verbose ? echo("Roundover scale factors:",scalefactors) : 0
|
||||||
)
|
)
|
||||||
assert(min(scalefactors)>1,str("Roundovers are too big for the path. If you multitply them by this vector they should fit: ",scalefactors))
|
assert(min(scalefactors)>=1,str("Roundovers are too big for the path. If you multitply them by this vector they should fit: ",scalefactors))
|
||||||
[
|
// duplicates are introduced when roundings fully consume a segment, so remove them
|
||||||
|
deduplicate([
|
||||||
for(i=[0:1:len(path)-1]) each
|
for(i=[0:1:len(path)-1]) each
|
||||||
(dk[i][0] == 0)? [path[i]] :
|
(dk[i][0] == 0)? [path[i]] :
|
||||||
(method=="smooth")? _bezcorner(select(path,i-1,i+1), dk[i]) :
|
(method=="smooth")? _bezcorner(select(path,i-1,i+1), dk[i]) :
|
||||||
(method=="chamfer") ? _chamfcorner(select(path,i-1,i+1), dk[i]) :
|
(method=="chamfer") ? _chamfcorner(select(path,i-1,i+1), dk[i]) :
|
||||||
_circlecorner(select(path,i-1,i+1), dk[i])
|
_circlecorner(select(path,i-1,i+1), dk[i])
|
||||||
];
|
]);
|
||||||
|
|
||||||
// Computes the continuous curvature control points for a corner when given as
|
// Computes the continuous curvature control points for a corner when given as
|
||||||
// input three points in a list defining the corner. The points must be
|
// input three points in a list defining the corner. The points must be
|
||||||
|
|
Loading…
Reference in a new issue