mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-01 14:00:30 +02:00
Rewrote PCO* parts to use arcleft/arcright turtle commands. Removed turtle_arc()
This commit is contained in:
@@ -878,36 +878,5 @@ function _turtle_command(command, parm, parm2, state, index) =
|
||||
[];
|
||||
|
||||
|
||||
// Function: turtle_arc(d,r,ang);
|
||||
// Usage:
|
||||
// arccmds = turtle_arc(d|r, ang);
|
||||
// Description:
|
||||
// Generates a list of `turtle()` commands to make an arc path.
|
||||
// Arguments:
|
||||
// r = The radius of the arc.
|
||||
// d = The diameter of the arc.
|
||||
// ang = The total angle to arc. Negative is clockwise.
|
||||
// n = If given, the number of segments.
|
||||
// Examples:
|
||||
// stroke(turtle(turtle_arc(d=100,arc=120)));
|
||||
// stroke(turtle(turtle_arc(d=100,arc=-45)));
|
||||
// stroke(turtle(concat(["move", 100], turtle_arc(d=100,arc=120), ["move", 100])));
|
||||
// stroke(turtle(["move", 100, "repeat", 1, turtle_arc(d=100,arc=120), "move", 100])));
|
||||
function turtle_arc(d,r,ang,n) =
|
||||
let(
|
||||
r = get_radius(r=r, d=d, dflt=1),
|
||||
n = max(2,default(n,ceil(segs(r)*abs(ang)/360))),
|
||||
stepang = ang/n
|
||||
) echo(n=n) concat(
|
||||
[
|
||||
for(i=[0:1:n-1]) each [
|
||||
stepang<0? "right" : "left", abs(stepang) * (i? 1 : 0.5),
|
||||
"move", abs(2*r*sin(stepang/2)),
|
||||
]
|
||||
],
|
||||
[stepang<0? "right" : "left", abs(stepang) * 0.5]
|
||||
);
|
||||
|
||||
|
||||
|
||||
// vim: noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
|
||||
|
Reference in New Issue
Block a user