mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-15 17:09:40 +00:00
Compare commits
13 commits
674c0279ef
...
c7569ac50e
Author | SHA1 | Date | |
---|---|---|---|
|
c7569ac50e | ||
|
d897c42a3c | ||
|
53af9121e7 | ||
|
736fad321b | ||
|
cc08eb3323 | ||
|
78ea8e4770 | ||
|
8383d360cc | ||
|
9145c0961f | ||
|
ebb98b47d2 | ||
|
8ea8ebf341 | ||
|
17e307fdb4 | ||
|
67f0004773 | ||
|
76d09271c1 |
2 changed files with 18 additions and 14 deletions
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()
|
||||||
|
|
|
@ -1012,20 +1012,21 @@ function regular_prism(n,
|
||||||
tex_depth = default(tex_depth,1),
|
tex_depth = default(tex_depth,1),
|
||||||
height = one_defined([l, h, length, height],"l,h,length,height",dflt=1),
|
height = one_defined([l, h, length, height],"l,h,length,height",dflt=1),
|
||||||
sc = 1/cos(180/n),
|
sc = 1/cos(180/n),
|
||||||
ir = u_mul(ir,sc),
|
ir1 = u_mul(default(ir1,ir), sc),
|
||||||
ir1 = u_mul(first_defined([ir1,ir,r]), sc),
|
ir2 = u_mul(default(ir2,ir), sc),
|
||||||
ir2 = u_mul(first_defined([ir2,ir,r]), sc),
|
id1 = u_mul(default(id1,id), sc),
|
||||||
id1 = u_mul(first_defined([id1,id,d]), sc),
|
id2 = u_mul(default(id2,id), sc),
|
||||||
id2 = u_mul(first_defined([id2,id,d]), sc),
|
|
||||||
od1 = default(od1,od),
|
od1 = default(od1,od),
|
||||||
od2 = default(od2,od),
|
od2 = default(od2,od),
|
||||||
or1 = default(or1,or),
|
or1 = default(or1,or),
|
||||||
or2 = default(or2,or),
|
or2 = default(or2,or),
|
||||||
|
d1 = default(d1,d),
|
||||||
|
d2 = default(d2,d),
|
||||||
side = is_finite(side)? side/2/sin(180/n) : undef,
|
side = is_finite(side)? side/2/sin(180/n) : undef,
|
||||||
side1 = is_finite(side1)? side1/2/sin(180/n) : side,
|
side1 = is_finite(side1)? side1/2/sin(180/n) : side,
|
||||||
side2 = is_finite(side2)? side2/2/sin(180/n) : side,
|
side2 = is_finite(side2)? side2/2/sin(180/n) : side,
|
||||||
r1 = get_radius(r1=ir1,r2=or1,r=r1,d=d1,d1=id1,d2=od1,dflt=side1),
|
r1 = get_radius(r1=ir1,r2=or1,r=default(r1,r),d=d1,d1=id1,d2=od1,dflt=side1),
|
||||||
r2 = get_radius(r1=ir2,r2=or2,r=r2,d=d2,d1=id2,d2=od2,dflt=side2),
|
r2 = get_radius(r1=ir2,r2=or2,r=default(r2,r),d=d2,d1=id2,d2=od2,dflt=side2),
|
||||||
anchor = get_anchor(anchor,center,BOT,CENTER)
|
anchor = get_anchor(anchor,center,BOT,CENTER)
|
||||||
)
|
)
|
||||||
assert(num_defined([side,od,id,or,ir])<=1, "Can only define one of side, id, od, ir, and or")
|
assert(num_defined([side,od,id,or,ir])<=1, "Can only define one of side, id, od, ir, and or")
|
||||||
|
|
Loading…
Reference in a new issue