dbn.js icon indicating copy to clipboard operation
dbn.js copied to clipboard

canvas size is 101x101 pixels

Open dribnet opened this issue 2 years ago • 4 comments

In dbn x=0 and y=0 are valid on-screen viewable locations and the addressable canvas size is 101x101 pixels. The interpreter is currently using a canvas size of 100x100 and cropping these out, removing a single line of pixels from both the bottom and left of the image. This is effecting both the interactive version and the exported gif files.

dribnet avatar Oct 23 '23 22:10 dribnet

Thanks so much for pointing this out! I wasn't aware; gonna fix this. (And I assume if size 200 200 is called, the canvas will be 201x201 pixels?)

LingDong- avatar Oct 25 '23 22:10 LingDong-

The original dbn covered in the book had no "size" command - all sketches were 101x101 pixels. 10201 addressable pixels is definitely idiosyncratic by today's standards, but maeda was very explicit that he wanted the dbn canvas to have a logical center. Early sketches were encouraged to be designed around this idea of an x=50 centerline, and in this port they appear slightly left of center.

I realize this might seem petty, but if people really are interested in the history of these toolkits, then I feel it is worthwhile to try to prevent any accidental "historical flattening" as its precisely these rough edges which make the language historically interesting and without them the language's quirky character and some of the constraints/decisions that shaped it are also lost.

dribnet avatar Nov 23 '24 05:11 dribnet

I made a PR to implement this change, took 10 seconds :)

https://github.com/LingDong-/dbn.js/pull/5

  • I have no idea if the examples will also need to be changed

gingerbeardman avatar Nov 23 '24 18:11 gingerbeardman

I think I have fixed this, so sorry for the delay, @dribnet

In addition to @gingerbeardman 's change, I commented out these 1px shifts:

https://github.com/LingDong-/dbn.js/blob/main/dbn.js#L294

I think when I first coded this, I noticed that the point (100,100) is visible in the original version, so I thought that the canvas starts at (1,1). Turns out it is instead because the canvas is 101x101.

This test now looks correct:

https://github.com/LingDong-/dbn.js/pull/5#issuecomment-2495668212

The change is live: https://dbn.glitch.me/

It's been a while and my DBN is a bit rusty, please let me know if if I missed anything! Thanks, and sorry again for the delay.

LingDong- avatar Dec 15 '24 22:12 LingDong-