The freehand trace mode converts a raw pointer polyline into a spline using a
small staged pipeline.
Current parameters
simplification tolerance: 2.0 pixels
corner threshold: 35 degrees
target spacing in smooth spans: 20.0 pixels
fit tolerance: 2.5 pixels
refinement iterations: 2
Pipeline
The raw pointer polyline is simplified with
PolylineUtils.RamerDouglasPeucker.
Corners are detected with PolylineUtils.DetectCorners.
Smooth spans are resampled with PolylineUtils.ResampleBySpacing.
New spline control points are created as corner or smooth.
A local spline is solved and rendered.
If the rendered path deviates too far from the simplified trace, a new smooth
knot is inserted at the worst sampled point and the refinement repeats.
Why this exists
This mode uses the library’s own simplification, rendering, and hit-testing
primitives to bootstrap a spline from approximate user input without introducing
UI-only geometry logic.