Fix #120698: GPv3: Don't move the first stroke point #121011

Merged
Lukas Tönne merged 1 commits from LukasTonne/blender:fix-gp3-point-first-point into main 2024-04-24 11:54:13 +02:00

1 Commits

Author SHA1 Message Date
Lukas Tönne 7deb55a0a6 Fix #120698: Don't move the first stroke point.
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
There are two ways the first stroke point is moved after initial
placement:
- The `process_extension_sample` overwrites the initial values of the
  sample point after `process_start_sample`. It copies the _new_ sample
  position, until a threshold (3 pixels) is reached and the 2nd point
  is created, and the 1st point remains stationary.
- After initial placement the point may still get shifted due to the
  resampling and interpolation used. Long sections between stroke
  samples may get subdivided and the positions of the two samples are
  linearly interpolated. However, the interpolation starts at 1/n,
  meaning the first interpolated point never matches the first sample.
  This is correct for later samples where the last point should not be
  repeated, but it ends up moving the first curve point again when the
  2nd sample is processed.

This patch fixes both issues by keeping the first generated point
stationary and never touching its position again.
2024-04-24 10:57:31 +02:00