Skip to content

fix(strokes): stabilisation spans a length of stroke, and expression fades with the filtering - #55

Open
lashmanRB wants to merge 1 commit into
artcraft-android:mainfrom
lashmanRB:input-smoothing
Open

lashmanRB wants to merge 1 commit into
artcraft-android:mainfrom
lashmanRB:input-smoothing

Conversation

@lashmanRB

@lashmanRB lashmanRB commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Two changes to input smoothing, both in crates/engine/src/stroke.rs.

Stabilisation took amount^2.2 * 120 samples each way. At 0.15 that averaged a single sample, while the top of the slider held the path back half a second. It now averages a 200 ms stretch resolved against the input's tuned rate: 4 samples at 0.15, 24 at 100%, and about 111 ms of trail measured. Measuring the window in time also gives the speed behaviour for free: a fixed stretch of time covers more of a fast stroke, so a quicker stroke is smoothed more. A test draws the same three wobbles over the same 600 px at two speeds and checks the quicker stroke comes out evener.

Motion Filtering Expression had no relation to the filtering amount, so it could lengthen the filter by 8x at any setting. Expression is now damped by 1 - amount: the more the filtering takes out, the less there is to let back through, and at the top of the slider it changes nothing at all. At low filtering it still lengthens the filter.

The filter kernels, the mirroring at the ends of the averaging window and the split between committed and tentative stamps are unchanged.

cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings and cargo test --workspace pass. Three tests cover the new behaviour, and one existing test that asserted a 200 px trail floor now asserts 60 px while still proving smoothing takes the same time at any input rate.

A third change - a stroke starting on the average of its first points rather than where the tip landed - is gone from this branch. Upstream shipped Tip Attachment (tip_attached) covering the same ground, and a second switch for it would only be something to reconcile later.

@lashmanRB
lashmanRB force-pushed the input-smoothing branch 3 times, most recently from 4c1b06f to 5eacd39 Compare November 8, 2026 12:20
@lashmanRB lashmanRB changed the title fix(strokes): stabilisation spans a length of stroke, expression fades with the filtering, and a stroke can start on its first points' average fix(strokes): stabilisation spans a length of stroke, and expression fades with the filtering Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant