Shapes: the Curvature Circle tool draws the circle a path bends along

The Curvature Circle tool, after the Circle tool in the Ellipse tool's
flyout, draws the circle that touches a path at a point and bends as the
path bends there, with shape.curvatureCircle. The pointer snaps to the
nearest path that is not a guide within 5 screen points, or within the
Smart Guides snapping tolerance when that is larger, and the tool shows
the circle as a dashed outline (solid once it is more than 50,000 screen
points around), its center, a line from the center to the point it
touches and, with Measurement Labels on, its radius. A click draws the
circle in one undo step, on the side the path bends toward; Shift held at
the press puts it on the other side. A press dragged 2 screen points or
more, or canceled with Escape, draws nothing.

A segment that is the usual cubic of a circular arc of 90° or less gives
a circle with the arc's own radius, shown with an asterisk, so a click on
a circle drawn with the Ellipse tool draws that circle. On a straight
segment, at a cusp or a corner anchor, or where the circle would reach
past the canvas, the pointer shows "Straight segment", "Cusp" or "Circle
too large", and a click draws nothing. An anchor is a corner when the
segments meet there at more than half a degree and it is not marked
smooth; segments of no length between them are passed over. The tool's
icon is new and drawn for VectorCraft.

shape.curvatureCircle takes the path, subpath, segment, t and convex, and
returns the circle's center and radius and whether the radius is an
arc's own. A guide is refused.

draw2::candidate_paths skips the selected paths with a hash set, so it
takes time linear in the number of paths on each pointer move.

Part of #7178.
This commit is contained in:
dotCooCoo
2026-11-17 20:18:05 -08:00
parent a5cc189172
commit de29baab11
47 changed files with 1308 additions and 8 deletions
+29
View File
@@ -6214,6 +6214,35 @@ perspective grid shows with an active plane, a Shift-click opens the size dialog
{"name":"run_command","arguments":{"command":"shape.circleThroughPoints","params":{"points":[[0,0],[80,0],[0,60]]}}}
```
## Curvature circle
`shape.curvatureCircle {id, subpath?, segment, t, convex?}` draws the circle that touches path `id` at `t` (0 to 1) on
segment `segment` of subpath `subpath` (0 when left out) and bends as the path bends there (its circle of curvature),
as a live ellipse with the current paint, and selects it. The circle goes on the side the path bends toward; with
`convex: true` it goes on the other side. A segment that is the usual cubic of a circular arc of 90° or less (its two
ends the same distance from the center, and each handle 4/3 · tan(θ/4) of the radius long for an arc of θ) gives a
circle with the arc's own radius, and on a circle drawn with the Ellipse tool the result is the circle itself. The
result is `{id, cx, cy, radius, nominal}`, where `nominal` is true for such an arc, and one undo removes the circle.
The circle is not pixel-aligned, even while [Align New Objects to Pixel Grid](#align-new-objects-to-pixel-grid) is on.
The command returns an error and draws nothing on a straight segment or the turning point of an S curve, at a cusp,
at an anchor whose handle is drawn back onto it, at a corner anchor (`t` 0 or 1 where two segments meet at an angle
of more than half a degree and the anchor is not marked smooth; segments of no length between them are passed over),
when the circle would reach past the canvas (4,000,000 pt from the origin), when `t` is not from 0 to 1, when `id` is
a guide, and when the path, subpath or segment does not exist.
The Curvature Circle tool, after the Circle tool in the Ellipse tool's toolbar group, draws with this command. The
pointer snaps to the nearest path that is not a guide within 5 screen points, or within Smart Guides › Snapping
Tolerance when that is larger, and the tool shows the circle that matches the path there as a dashed outline (solid
once it is more than 50,000 screen points around), a small cross at its center, a line from the center to the point
it touches and, with Measurement Labels on, its radius by the pointer, followed by an asterisk for an arc's own
radius. A click draws the circle, and a press dragged 2 screen points or more, or canceled with Escape, draws nothing;
Shift held at the press puts the circle on the other side of the path. On a straight segment, at a cusp or a corner, or where the circle would
reach past the canvas, the pointer shows "Straight segment", "Cusp" or "Circle too large", and a click draws nothing.
```json
{"name":"run_command","arguments":{"command":"shape.curvatureCircle","params":{"id":12,"segment":0,"t":0.5}}}
```
## Editing a path with the Curvature tool
The Curvature tool edits any selected path, whatever drew it, keeping its shape except where edited (#798). Each edit