mondrian icon indicating copy to clipboard operation
mondrian copied to clipboard

Better smoothing of crayon points.

Open Fishrock123 opened this issue 11 years ago • 5 comments

This will take a while, but should be something to work towards.

mondrian is going to need a smoothing algorithm for crayon points.

Fishrock123 avatar Jan 25 '14 16:01 Fishrock123

I would use Schneider's path fitting algorithm:

  • demo http://paperjs.org/examples/path-simplification/
  • original implementation: http://tog.acm.org/resources/GraphicsGems/gems/FitCurves.c
  • JavaScript port: https://github.com/paperjs/paper.js/blob/master/src/path/PathFitter.js

jarek-foksa avatar Jan 25 '14 18:01 jarek-foksa

:+1: to @jarek-foksa's suggestion.

Fishrock123 avatar Jan 25 '14 21:01 Fishrock123

I'll take an hour one day to learn about Schneider's algorithm. Haven't heard of it before. That paperjs demo is amazing.

The crayon tool uses a simple algorithm I came up with. It only produces smooth lines when one draws quickly. I'd love to port a better algo to it.

artursapek avatar Jan 26 '14 01:01 artursapek

I like the smoothed results of Schneider's, but it does not do corners well. — Sent from Mailbox for iPhone

On Sat, Jan 25, 2014 at 8:58 PM, Artur Sapek [email protected] wrote:

I'll take an hour one day to learn about Schneider's algorithm. Haven't heard of it before. That paperjs demo is amazing.

The crayon tool uses a simple algorithm I came up with. It only produces smooth lines when one draws quickly. I'd love to port a better algo to it.

Reply to this email directly or view it on GitHub: https://github.com/artursapek/mondrian/issues/15#issuecomment-33306728

wraybowling avatar Jan 26 '14 13:01 wraybowling

@wraybowling Oh wow, you're right. (Try drawing boxes in the demo.)

I would be more inclined to go with something a tad slower and more precise, generally.

Fishrock123 avatar Feb 01 '14 15:02 Fishrock123