You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, I does not understand why you multiply 255 and divide by width or height.
Because the coordinate system used by the library has north-west/top-left as (x=0,y=0) and south-east/bottom-right as (x=255,y=255).
Is it just a normalization step to ensure the coordinates are consistent?
So yes, unless you're already working in the same coordinate system, you need to map the coordinates used by your canvas (which in this case is indeed 400x400, not 255x255) onto the coordinate system used by the library.
In this case, that only requires making sure x and y are in the range 0-255 instead of 0-400, in other cases you may also need to account for the origin (x=0,y=0) being e.g. bottom-left (or in the middle) instead of top-left.
As it happens, the canvas used here can produce values outside the 0-400 range when you draw "over the edge" at sufficient velocity, so values can actually fall outside that range (#20); the JavaScript interface used by Jiten already handles this.
I've been meaning to document the API properly, but never got around to it; I did create an issue now: #19 😅
How did you define the magic number 255 ?
As the README says "the algorithms are based on the Kanji draw Android app", which also uses the range 0-255. A smaller range would probably have worked as well, but 2^8 seemed a reasonable choice so I used the same range.
Hello author,
strokes is the list of pair (x,y) coordinates. However, I does not understand why you multiply 255 and divide by width or height.
As far as I know, the width and height is equal to 400 ?
Is it just a normalization step to ensure the coordinates are consistent?
How did you define the magic number 255 ?
The text was updated successfully, but these errors were encountered: