Add GCD grid example
This commit is contained in:
parent
1496a0fd12
commit
9551806b17
4 changed files with 15 additions and 1 deletions
|
@ -22,6 +22,8 @@ cd examples
|
|||
make all
|
||||
#+end_src
|
||||
|
||||
[[./examples/gcdgrid.png]]
|
||||
|
||||
[[./examples/hsv.png]]
|
||||
[[./examples/gradient.png]]
|
||||
|
||||
|
|
|
@ -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 $< > $@
|
||||
|
|
12
examples/gcdgrid.bqn
Normal file
12
examples/gcdgrid.bqn
Normal file
|
@ -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
|
BIN
examples/gcdgrid.png
Normal file
BIN
examples/gcdgrid.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 641 B |
Loading…
Add table
Add a link
Reference in a new issue