mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-15 08:59:40 +00:00
Compare commits
13 commits
aa9a78cd01
...
55153a9bdf
Author | SHA1 | Date | |
---|---|---|---|
|
55153a9bdf | ||
|
289d6afb3e | ||
|
53af9121e7 | ||
|
736fad321b | ||
|
cc08eb3323 | ||
|
78ea8e4770 | ||
|
8383d360cc | ||
|
9145c0961f | ||
|
ebb98b47d2 | ||
|
8ea8ebf341 | ||
|
17e307fdb4 | ||
|
67f0004773 | ||
|
76d09271c1 |
2 changed files with 10 additions and 7 deletions
|
@ -3755,7 +3755,7 @@ function _find_anchor(anchor, geom) =
|
||||||
direction= unit(mean([for(face=edgefaces) polygon_normal(select(vnf[0],vnf[1][face]))])),
|
direction= unit(mean([for(face=edgefaces) polygon_normal(select(vnf[0],vnf[1][face]))])),
|
||||||
edgedir = edge[1]-edge[0],
|
edgedir = edge[1]-edge[0],
|
||||||
nz = [for(i=[0:2]) if (!approx(edgedir[i],0)) i],
|
nz = [for(i=[0:2]) if (!approx(edgedir[i],0)) i],
|
||||||
flip = last(nz) < 0 ? -1 : 1,
|
flip = edgedir[last(nz)] < 0 ? -1 : 1,
|
||||||
spin = _compute_spin(direction, flip*edgedir)
|
spin = _compute_spin(direction, flip*edgedir)
|
||||||
)
|
)
|
||||||
[direction,spin]
|
[direction,spin]
|
||||||
|
|
15
beziers.scad
15
beziers.scad
|
@ -466,12 +466,15 @@ function bezpath_curve(bezpath, splinesteps=16, N=3, endpoint=true) =
|
||||||
assert(len(bezpath)%N == 1, str("A degree ",N," bezier path should have a multiple of ",N," points in it, plus 1."))
|
assert(len(bezpath)%N == 1, str("A degree ",N," bezier path should have a multiple of ",N," points in it, plus 1."))
|
||||||
let(
|
let(
|
||||||
segs = (len(bezpath)-1) / N,
|
segs = (len(bezpath)-1) / N,
|
||||||
step = 1 / splinesteps
|
step = 1 / splinesteps,
|
||||||
) [
|
path = [
|
||||||
for (seg = [0:1:segs-1])
|
for (seg = [0:1:segs-1])
|
||||||
each bezier_points(select(bezpath, seg*N, (seg+1)*N), [0:step:1-step/2]),
|
each bezier_points(select(bezpath, seg*N, (seg+1)*N), [0:step:1-step/2]),
|
||||||
if (endpoint) last(bezpath)
|
if (endpoint) last(bezpath)
|
||||||
];
|
],
|
||||||
|
is_closed = approx(path[0], last(path)),
|
||||||
|
out = path_merge_collinear(path, closed=is_closed)
|
||||||
|
) out;
|
||||||
|
|
||||||
|
|
||||||
// Function: bezpath_closest_point()
|
// Function: bezpath_closest_point()
|
||||||
|
|
Loading…
Reference in a new issue