187 double direction=0, direction_2=0;
189 pathpoint cur_point, last_point, next_point;
190 double x=0, y=0,
dist;
193 double lineout=0, linerad=0, linelen=0;
196 size_t pathcount = vararr_size(&arr);
197 pathpoint *pathpoints = vararr_detach(&arr);
201 for (
size_t i = 0; i < pathcount; i++) {
202 const size_t l = i == 0 ? pathcount - 1 : i - 1;
203 const size_t n = (i + 1) % pathcount;
205 cur_point = pathpoints[i];
210 next_point = pathpoints[n];
213 ndir =
myatan (ny-y, nx-x);
215 last_point = pathpoints[l];
218 ldir =
myatan (ly-y, lx-x);
224 linerad = radfunc(
dist, linelen, initwid);
226 if (i == 0 || i == pathcount-1) {
229 direction = ndir +
D2R(90);
231 direction = ldir -
D2R(90);
233 direction_2 = direction;
239 phi =
D2R(90) - theta / 2;
244 lineout = linerad / cos(phi);
247 direction = ndir+
D2R(90)+phi;
253 if (i == pathcount-1) {
257 direction_2 = direction;
263 pathpoints[i].
type =
'l';
264 pathpoints[i].
dir = direction;
265 pathpoints[i].
lout = lineout;
266 pathpoints[i].
bevel = bevel;
267 pathpoints[i].
dir2 = direction_2;
273 for (
size_t i = 0; i < pathcount; i++) {
274 cur_point = pathpoints[i];
277 direction = cur_point.
dir;
278 lineout = cur_point.
lout;
279 bool bevel = cur_point.
bevel;
280 direction_2 = cur_point.
dir2;
282 moveto(&p, x+cos(direction)*lineout, y+sin(direction)*lineout);
284 lineto(&p, x+cos(direction)*lineout, y+sin(direction)*lineout);
287 drawbevel(x, lineout,
true, direction, direction_2, &p);
291 direction +=
D2R(180);
292 lineto(&p, x+cos(direction)*lineout, y+sin(direction)*lineout);
294 assert(pathcount > 0);
295 for (
size_t i = pathcount - 2; i !=
SIZE_MAX; i--) {
296 cur_point = pathpoints[i];
299 direction = cur_point.
dir +
D2R(180);
300 lineout = cur_point.
lout;
301 bool bevel = cur_point.
bevel;
302 direction_2 = cur_point.
dir2 +
D2R(180);
303 lineto(&p, x+cos(direction_2)*lineout, y+sin(direction_2)*lineout);
305 drawbevel(x, lineout,
false, direction, direction_2, &p);
static void drawbevel(double x, double lineout, bool forward, double dir, double dir2, stroke_t *p)