diff --git a/README.org b/README.org index 93be764..497c9a5 100644 --- a/README.org +++ b/README.org @@ -22,6 +22,8 @@ cd examples make all #+end_src +[[./examples/gcdgrid.png]] + [[./examples/hsv.png]] [[./examples/gradient.png]] diff --git a/examples/Makefile b/examples/Makefile index 1523ca0..9c85025 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -1,5 +1,5 @@ .PHONY: all -all: checkers.png random_pbm.png random_pgm.png random_ppm.png gradient.png hsv.png +all: checkers.png random_pbm.png random_pgm.png random_ppm.png gradient.png hsv.png gcdgrid.png %.pnm: %.bqn bqn $< > $@ diff --git a/examples/gcdgrid.bqn b/examples/gcdgrid.bqn new file mode 100644 index 0000000..6acf3ce --- /dev/null +++ b/examples/gcdgrid.bqn @@ -0,0 +1,12 @@ +bqngraphics←"../" +⟨Viridis⟩←•Import bqngraphics∾"colormaps.bqn" +⟨HSVtoRGB⟩←•Import bqngraphics∾"colors.bqn" +⟨PBM,PGM,PPM⟩←•Import bqngraphics∾"pnm.bqn" + +# https://susam.net/blog/gcd-grid.html +GCDGrid←•math.GCD⌜˜↕ + +•Out PBM 1≠GCDGrid 50 +#•Out PGM GCDGrid 20 +#•Out PPM {⌊255×HSVtoRGB⎉1⍉(360×𝕩÷1+⌈˝𝕩)∾(2∾≢𝕩)⥊1}GCDGrid 20 +#•Out PPM ⌊255×> Viridis¨ (⊢÷⌈´∘⥊) GCDGrid 20 diff --git a/examples/gcdgrid.png b/examples/gcdgrid.png new file mode 100644 index 0000000..f2e3be1 Binary files /dev/null and b/examples/gcdgrid.png differ