Closed fokx closed 3 years ago
The median was computed by turning the stroke into a dense polygon (i.e. with many vertices, close together), computing the Voronoi diagram of that polygon, and dropping everything all the Voronoi points except for the innermost spline.
The intuition for why this works is because the Voronoi points are halfway between two vertices of the polygon, so when you have a long, narrow polygon like a stroke, the Voronoi spline runs right down the middle.
I used @gorhill's Javascript Voronoi library to do that geometric computation. (That's the same @gorhill of uBlock and uMatrix fame - thank you so much for what you've made!)
Here's a link to the logic that wraps that library and does the filtering.
Thank you very much!
In you README.md, you says: medians: A list of stroke medians, in the same coordinate system as the SVG paths above. These medians can be used to produce a rough stroke-order animation, although it is a bit tricky. Each median is a list of pairs of integers. This list will be as long as the strokes list. Could you provide a script you used to work that out? Thanks.