mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-04 03:09:45 +00:00
Code formatting standardization in shapes2d.scad
This commit is contained in:
parent
c0478728d2
commit
9f0d4f9465
1 changed files with 8 additions and 9 deletions
|
@ -809,7 +809,7 @@ function _turtle_command(command, parm, parm2, state, index) =
|
||||||
path = 0,
|
path = 0,
|
||||||
step=1,
|
step=1,
|
||||||
angle=2,
|
angle=2,
|
||||||
arcsteps=3,
|
arcsteps=3,
|
||||||
parm = !is_string(parm) ? parm : undef,
|
parm = !is_string(parm) ? parm : undef,
|
||||||
parm2 = !is_string(parm2) ? parm2 : undef,
|
parm2 = !is_string(parm2) ? parm2 : undef,
|
||||||
needvec = ["jump"],
|
needvec = ["jump"],
|
||||||
|
@ -857,7 +857,7 @@ function _turtle_command(command, parm, parm2, state, index) =
|
||||||
command=="length" ? list_set(state, step, parm*normalize(state[step])) :
|
command=="length" ? list_set(state, step, parm*normalize(state[step])) :
|
||||||
command=="scale" ? list_set(state, step, parm*state[step]) :
|
command=="scale" ? list_set(state, step, parm*state[step]) :
|
||||||
command=="addlength" ? list_set(state, step, state[step]+normalize(state[step])*parm) :
|
command=="addlength" ? list_set(state, step, state[step]+normalize(state[step])*parm) :
|
||||||
command=="arcsteps" ? list_set(state, arcsteps, parm) :
|
command=="arcsteps" ? list_set(state, arcsteps, parm) :
|
||||||
command=="arcleft" || command=="arcright" ?
|
command=="arcleft" || command=="arcright" ?
|
||||||
assert(is_num(parm),str("\"",command,"\" command requires a numeric radius value at index ",index))
|
assert(is_num(parm),str("\"",command,"\" command requires a numeric radius value at index ",index))
|
||||||
let(
|
let(
|
||||||
|
@ -865,7 +865,7 @@ function _turtle_command(command, parm, parm2, state, index) =
|
||||||
lrsign = command=="arcleft" ? 1 : -1,
|
lrsign = command=="arcleft" ? 1 : -1,
|
||||||
radius = parm*sign(myangle),
|
radius = parm*sign(myangle),
|
||||||
center = lastpt + lrsign*radius*line_normal([0,0],state[step]),
|
center = lastpt + lrsign*radius*line_normal([0,0],state[step]),
|
||||||
steps = state[arcsteps]==0 ? segs(abs(radius)) : state[arcsteps],
|
steps = state[arcsteps]==0 ? segs(abs(radius)) : state[arcsteps],
|
||||||
arcpath = myangle == 0 || radius == 0 ? [] : arc(
|
arcpath = myangle == 0 || radius == 0 ? [] : arc(
|
||||||
steps,
|
steps,
|
||||||
points = [
|
points = [
|
||||||
|
@ -885,14 +885,13 @@ function _turtle_command(command, parm, parm2, state, index) =
|
||||||
assert(is_num(parm),str("\"",command,"\" command requires a numeric radius value at index ",index))
|
assert(is_num(parm),str("\"",command,"\" command requires a numeric radius value at index ",index))
|
||||||
assert(is_num(parm2),str("\"",command,"\" command requires a numeric angle value at index ",index))
|
assert(is_num(parm2),str("\"",command,"\" command requires a numeric angle value at index ",index))
|
||||||
let(
|
let(
|
||||||
radius = parm,
|
radius = parm,
|
||||||
lrsign = command=="arcleftto" ? 1 : -1,
|
lrsign = command=="arcleftto" ? 1 : -1,
|
||||||
center = lastpt + lrsign*radius*line_normal([0,0],state[step]),
|
center = lastpt + lrsign*radius*line_normal([0,0],state[step]),
|
||||||
steps = state[arcsteps]==0 ? segs(abs(radius)) : state[arcsteps],
|
steps = state[arcsteps]==0 ? segs(abs(radius)) : state[arcsteps],
|
||||||
start_angle = posmod(atan2(state[step].y, state[step].x),360),
|
start_angle = posmod(atan2(state[step].y, state[step].x),360),
|
||||||
end_angle = posmod(parm2,360),
|
end_angle = posmod(parm2,360),
|
||||||
delta_angle = -start_angle + (lrsign * end_angle < lrsign*start_angle ? end_angle+lrsign*360 : end_angle),
|
delta_angle = -start_angle + (lrsign * end_angle < lrsign*start_angle ? end_angle+lrsign*360 : end_angle),
|
||||||
fda= echo(angles = start_angle, end_angle,delta_angle, lrsign),
|
|
||||||
arcpath = delta_angle == 0 || radius==0 ? [] : arc(
|
arcpath = delta_angle == 0 || radius==0 ? [] : arc(
|
||||||
steps,
|
steps,
|
||||||
points = [
|
points = [
|
||||||
|
|
Loading…
Reference in a new issue