Skip to content

Commit

Permalink
New drawing: hexspiral, a hexagonal spiral. A turtle drawing, just fo…
Browse files Browse the repository at this point in the history
…r a change. Not yet able to scale up for the big plotters, but should be the right size for A3. Would look nice in six colours, but would be much slower with all those pen changes.
  • Loading branch information
anachrocomputer committed May 4, 2019
1 parent 01c567d commit 1fd2adc
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ flake
fraserspiral
hconic2
hexagon
hexspiral
hilb
hyp
isogrid
Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ HPGL=flake.hpgl op.hpgl dala1.hpgl hconic2.hpgl tree.hpgl dome.hpgl \
curve_stitching.hpgl cs_rosette.hpgl allover13.hpgl allover12.hpgl \
qrplot.hpgl lotus.hpgl celticstep.hpgl op_moire.hpgl sutpent.hpgl \
morphpoly.hpgl pin_circle.hpgl isogrid.hpgl circle_lines.hpgl \
star_grid.hpgl ternary_arcs.hpgl
star_grid.hpgl ternary_arcs.hpgl hexspiral.hpgl

PNG=$(HPGL:.hpgl=.png)

Expand Down Expand Up @@ -385,6 +385,15 @@ hexagon: hexagon.o turtle.o
hexagon.o: hexagon.c turtle.h
$(CC) $(CFLAGS) -o $@ hexagon.c

hexspiral.hpgl: hexspiral
./hexspiral >hexspiral.hpgl

hexspiral: hexspiral.o turtle.o
$(LD) -o $@ hexspiral.o turtle.o -lm

hexspiral.o: hexspiral.c turtle.h
$(CC) $(CFLAGS) -o $@ hexspiral.c

plottext: plottext.o turtle.o
$(LD) -o $@ plottext.o turtle.o -lm

Expand Down
25 changes: 25 additions & 0 deletions hexspiral.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* hexspiral --- plot a hexagonal spiral 2019-05-04 */
/* Copyright (c) 2019 John Honniball, Froods Software Development */

#include <stdio.h>
#include "turtle.h"

int main(int argc, const char *argv[])
{
int i;

turtle(DEV_HPGL, SIZ_A4, ORI_LAND, FLG_BORD);

colour(BLACK);

pen(DOWN);

for (i = 1; i < 360; i++) {
forward((double)i / 4.0);
turn(59.0);
}

show();

return (0);
}

0 comments on commit 1fd2adc

Please sign in to comment.