steveruizok / perfect-freehand

Draw perfect pressure-sensitive freehand lines.
https://perfectfreehand.com
MIT License
4.48k stars 156 forks source link

Updating from 1.0.4 to 1.0.16 changed the appearance of the output significantly #40

Closed tarngerine closed 2 years ago

tarngerine commented 2 years ago

Did something change in the algorithm? I bumped the package today to fix a bug (1.0.4 was generating invalid polygons in certain case) — good news is the bug is gone, but the shape has changed significantly with the same settings.

Any insight on what changed?

1.0.4:

image

1.0.16:

image

getStroke(coords)

[
  [-696, 1059],
  [-696, 1059],
  [-674, 857],
  [-607, 520],
  [-562, 116],
  [-472, -289],
  [-427, -603],
  [-404, -626],
  [-404, -536],
  [-404, -266],
  [-427, -64],
  [-427, -42],
  [-337, -177],
  [-157, -469],
  [23, -738],
  [247, -1008],
  [382, -1143],
  [405, -1165],
  [405, -1120],
  [405, -985],
  [427, -626],
  [427, -469],
  [427, -424],
  [472, -491],
  [539, -603],
  [697, -761],
  [809, -918],
  [854, -963],
  [877, -963],
  [877, -918],
  [921, -693],
  [944, -379],
  [989, -132],
  [989, 71],
  [989, 205],
  [989, 228]
];

settings:

{
              smoothing: 1,
              streamline: 1,
              thinning: 0,
              start: {
                cap: true,
                taper: 0
              },
              size: 235.883074766576
            }
tarngerine commented 2 years ago

i can get kinda close with smoothing .6 streamline .7 but it doesnt feel the same

image
tarngerine commented 2 years ago

the new end caps are much cleaner tho! dig it.

just concerned about regressing our users data

steveruizok commented 2 years ago

Hey @tarngerine, this one indeed had more of a visual change than I expected on some projects. Sorry! I'll be working to make sure the lines stay more or less consistent between versions. There aren't many other changes between the two versions (primarily bug fixes related to lines with one or two points), so if the earlier version is still working for you, you may want to stay on that version.

tarngerine commented 2 years ago

Gotcha, that's what I figured, and we did have to update bc of the bug fixed. Not a huge deal! Thanks!