jsoftware / j-playground

J playground
https://jsoftware.github.io/j-playground/bin/html2/
Other
10 stars 5 forks source link

viewmat -- assertion failure: enclength #94

Open rdm opened 2 years ago

rdm commented 2 years ago

This works:

rgbc=: {{1-x*0>.1<.(<.4&-)6|m+y%60}}
hsv=: 5 rgbc(,"0 1) 3 rgbc(,"0) 1 rgbc
degrees=: {{180p_1*{:"1+.^.y}}
wheel=: {{((1>:|)*|hsv degrees)j./~y%~i:y}}
require'viewmat'
'rgb' viewmat 256#.<.255*wheel 80

Changing the 80 on that last line to 81 does not work in the current playground:

   'rgb' viewmat 256#.<.255*wheel 81
|assertion failure: enclength
|       (0<:ex)*.(30>:ex)
|[-0] 
bilam commented 2 years ago

the enclength should be part of zlib addons. viewmat first write png to file before display. I think jplayground can't load any graphics library so that it use pure J implementation of png and zlib. I have tried to simulate with the following script but can't duplicate the assertion failure. load'arc/zlib' NOZLIBjzlib=: 1 USEPPPNGz=: 0 rgbc=: {{1-x0>.1<.(<.4&-)6|m+y%60}} hsv=: 5 rgbc(,"0 1) 3 rgbc(,"0) 1 rgbc degrees=: {{180p_1{:"1+.^.y}} wheel=: {{((1>:|)|hsv degrees)j./~y%~i:y}} require'viewmat' 'rgb' viewmat 256#.<.255wheel 81

BTW I suggest jplayground load browser compatible node libraries such as png,jpeg,zlib for performance.