Add GCD grid example

This commit is contained in:
Dimitri Lozeve 2023-03-18 18:43:54 +01:00
parent 1496a0fd12
commit 9551806b17
4 changed files with 15 additions and 1 deletions

12
examples/gcdgrid.bqn Normal file
View 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 1GCDGrid 50
#•Out PGM GCDGrid 20
#•Out PPM {⌊255×HSVtoRGB⎉1⍉(360×𝕩÷1+⌈˝𝕩)∾(2∾≢𝕩)⥊1}GCDGrid 20
#•Out PPM ⌊255×> Viridis¨ (⊢÷⌈´∘⥊) GCDGrid 20