mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
The Curvature tool built its curve as a uniform Catmull-Rom: both handles of a smooth point a sixth of the chord between its neighbours, the ends of an open path without handles. Uneven spacing overshot or looped, a J or U from three points bent sharply at the middle with straight legs, and the end segments looked flat. - `curvature_spline` (draw2.rs) makes each stretch of three points follow the circle through them: a smooth point's tangent is that circle's (`smooth_handles`), each handle `chord / (3 cos²(α/2))` long, α between handle and chord capped at 90° (`arc_handle`). The ends of an open path mirror their neighbour's tangent in their chord (`end_handle`). A turn tighter than 30° (`TIGHT_TURN`) shortens its handles, so a narrow V comes to a point. Degenerate points become corners. `path.curvature` and the rubber band use it. - `catmull_rom` is unchanged for the Pencil and Paintbrush fitting. - `bend_last` (from: smooth), `curvature_move` on a smooth point, the point `curvature_insert` adds on a straight segment, and `path.convertAnchor` to smooth without x/y (`curvature_smooth`) use the same rule. - `curvature_extend` gives the new end its end handle unless Alt-clicked (`corner` param on `path.curvatureEdit`). - Neighbours of a point dragged on an existing path keep their tangents (a Pen-drawn shape isn't reshaped); the path being drawn re-curves throughout.