Arcs

You can create both circular and elliptic arcs with the R(rx,ry,a,da) command. For a circular arc set rx=ry. The arc is centered at the current position and its starting point is at angle a from the current direction. Positive angles are to the left of the current direction (counterclockwise) and negative angles are to the right (clockwise). The angle swept out by the arc from the starting to the ending point is da. The command R(1,1,-pi/2,pi) will draw a half circle of radius 1. The program (arc1.nll) will draw a half circle on each side of a square.

Program: (arc1.nll)

T1 : L(1) T(pi/2);
T2 : [M(0.5) T(-pi/2) R(0.5,0.5,-pi/2,pi)] M(1) T(pi/2);
START : P(0.5,0.5) <S(T1,3) Z()> S(T2,4);

Command line

nell arc1.nll START 10 | nellsvg 2 2 in 0.02 1 > arc1.svg

This can be generalized to drawing a half circle on each side of an n-sided polygon. Program (arc2.nll) shows how to do it but without drawing the sides of the polygon.

Program: (arc2.nll)

n = 5;
a = 2*pi/n;
T1 : L(1) T(pi/2);
T2 : [M(0.5) T(-pi/2) R(0.5,0.5,-pi/2,pi)] M(1) T(a);
START : P(0.75,0.5) S(T2,n);

Command line

nell arc2.nll START 3 | nellsvg 2.5 2.3 in 0.02 1 > arc2.svg

The program (arc3.nll) is basically the same as (arc2.nll) but it draws a half ellipse instead of a half circle. The radius of the ellipse extending away from the center is three times the radius along the edges.

Program: (arc3.nll)

n = 6;
a = 2*pi/n;
T1 : L(1) T(pi/2);
T2 : [M(0.5) T(-pi/2) R(1.5,0.5,-pi/2,pi)] M(1) T(a);
START : P(1.6,1.5) S(T2,n);

Command line

nell arc3.nll START 3 | nellsvg 4.2 4.8 in 0.02 1 > arc3.svg

The program (arc4.nll) draws elliptic arcs at evenly spaced angles around a common center.

Program: (arc4.nll)

n = 24;
a = 2*pi/n;
T1 : R(1.5,0.5,-0.38,pi/2) T(a);
START : P(1.55,1.55) S(T1,n) C(0.73);

Command line

nell arc4.nll START 3 | nellsvg 3.1 3.1 in 0.02 1 > arc4.svg

The program (arc5.nll) draws a crescent using circular arcs.

Program: (arc5.nll)

a = 5*pi/8;
START : P(0.6,1.15) R(1,1,-pi/2,pi) M(0.4) R(1.1,1.1,-a,2*a);

Command line

nell arc5.nll START 3 | nellsvg 2.25 2.3 in 0.02 1 > arc5.svg