mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-26 20:46:22 +01:00
Path Precision Tools: Add Inscribed Circle bounds its work and memory
- The searches for all the selected objects share one limit of 134,217,728 distances from a point to an edge, as Add Bounding Circle shares its splits, and each cell is measured only when the limit has room for it. One search keeps at most 1,048,576 cells waiting. The pathops crate adds inscribed_circle_within for a shared budget. - The search stops once its best center is within the precision of half the box's narrower side, so a long rectangle ends at its first cells, and cells that cannot beat the best center are no longer queued. - A fill much smaller than the precision still gets a circle: the search keeps splitting until it finds a center inside the outline. - The precision also follows the box of the area the fill rule leaves. - Flattening stops at the first curve past the edge limit. An outline that flattening closes up, or whose center lands outside the curves, is flattened up to four times, 16 times finer each time; one it still cannot resolve is too complex to measure, not empty. Areas are summed from each contour's own first point. - An outline with more than 262,144 anchors in its filled subpaths is refused before it is resolved. - A selected layer is refused like any other object that is not a path, and inside an isolated compound path the circles join it, as Tangent Circle's do. - The menu item uses a named constant, and a UI test checks that it runs the command with no dialog and selects a new live circle in each selected shape, as one undo step. - The params text and docs say that the 0.02 pt bound holds before the circle is drawn 0.03% smaller, that a shape under 10 pt across is measured to a five-hundredth of its narrower side, when long curves are flattened more coarsely, and that edges can move by 1e-6 pt as in the other path operations.
This commit is contained in:
1 parent
80f96d11f9
commit
70a56fb5be
10 files changed
+436
-68
No files matched your search
+18
-12
@@ -14821,18 +14821,24 @@ Commands:
|
||||
[pole of inaccessibility](https://en.wikipedia.org/wiki/Pole_of_inaccessibility). A path of a compound path
|
||||
selected on its own counts as a path. The circle lies in the area the shape fills under its fill rule: holes and the
|
||||
overlaps of crossing subpaths count as the fill shows them, and strokes and effects are left out. The command
|
||||
flattens the outline to within 0.005 pt and searches square cells best first, measuring the radius from the center
|
||||
to the curves, so its radius is within 0.02 pt of the largest. A shape whose
|
||||
box is less than 10 pt across on its narrower side is measured to a thousandth of that side instead. A curve whose
|
||||
control polygon is longer than 83,886 pt is flattened more coarsely, and the circle can be smaller by as much. The
|
||||
drawn circle's four curves reach up to 0.03% of its radius past a true circle, so the command draws it that much
|
||||
smaller, and it stays inside where it touches the shape. Narrow holes count; holes and gaps narrower than 1e-6 pt close up, as
|
||||
in the other path operations. The circles get the current paint and go on top of the current layer, or of the isolated group, as other new art does.
|
||||
The new circles are selected, and one undo removes them all. It is an error, with the document unchanged, when a selected
|
||||
object is not a closed path or compound path ("object N is not a closed path or compound path"; an open path has no
|
||||
inside), when it fills no area ("object N fills no area"), and when its outline has more than 262,144 straight
|
||||
pieces once flattened, or the search measures more than 134,217,728 distances from a point to an edge ("object N is
|
||||
too complex to measure").
|
||||
flattens the outline to within 0.005 pt and searches square cells best first to within 0.01 pt, then measures the
|
||||
radius from the center to the curves, so before the circle is drawn its radius is within 0.02 pt of the largest.
|
||||
When the box of the filled area is less than 10 pt across on its narrower side, the search and the flattening use
|
||||
a thousandth and a two-thousandth of that side, and the radius is within a five-hundredth of it. A curve whose
|
||||
control polygon is longer than 4096² times the flattening tolerance (83,886 pt at 0.005 pt) is flattened more
|
||||
coarsely, and the circle can be smaller by as much. A curved hole narrower than the flattening tolerance can also
|
||||
make it smaller. A shape that flattening would close up or move off its curves is flattened finer, down to 1/65,536
|
||||
of the tolerance. The drawn circle's four curves reach up to 0.03% of its radius past a true circle, so the command
|
||||
draws it 0.03% smaller, and it stays inside where it touches the shape. Holes and gaps narrower than 1e-6 pt close
|
||||
up, and edges can move by as much, as in the other path operations. The circles get the current paint and go on
|
||||
top of the current layer, or of the isolated group, as other new art does; inside an isolated compound path they
|
||||
join it and take its appearance. The new circles are selected, and one undo removes them all. It is an error,
|
||||
with the document unchanged, when a selected object is not a closed path or compound path ("object N is not a
|
||||
closed path or compound path"; an open path has no inside), when it fills no area ("object N fills no area"), and
|
||||
when its outline has more than 262,144 anchors (in subpaths of two or more) or more than 262,144 straight pieces
|
||||
once flattened, or the searches of all the selected objects together measure more than 134,217,728 distances from
|
||||
a point to an edge, or one search keeps more than 1,048,576 cells waiting, or the shape is so thin for its length
|
||||
that it flattens to no area even at the finest tolerance ("object N is too complex to measure").
|
||||
→ `{id: the first circle, ids}`
|
||||
|
||||
A parametric shape is an ordinary path. It keeps its numbers, with a fingerprint of the outline they drew, in one
|
||||
|
||||
@@ -2991,7 +2991,7 @@ A VectorCraft addition, so no area score moves. Object › Plug-ins › Path Pre
|
||||
|
||||
## Path Precision Tools add-on: Add Inscribed Circle (2026-11-22)
|
||||
|
||||
A VectorCraft addition, so no area score moves. Object › Plug-ins › Path Precision Tools › Add Inscribed Circle (`addon.pathtools.inscribedCircle`) draws the largest live circle inside each selected closed path or compound path, centered on the shape's [pole of inaccessibility](https://en.wikipedia.org/wiki/Pole_of_inaccessibility). The rest is VectorCraft's own: the shape is first resolved under its fill rule into outer contours and holes, flattened to within 0.005 pt and searched in square cells best first, and the radius is measured from the center to the curves, within 0.02 pt of the largest (a shape less than 10 pt across is measured to a thousandth of its narrower side), and the circle is drawn up to 0.03% smaller, by as much as its four curves reach past a true circle, so it stays inside. The circles use the current paint, go on top of the current layer or the isolated group, and are one undo step (#6966). Open paths, other objects, shapes that fill no area, and outlines past 262,144 flattened pieces or the search's work limit are errors. Tests: `addons::pathtools::inscribed::tests` in `vectorcraft-pathops` (a square, a concave shape, a ring under both fill rules, overlapping subpaths, a small shape, a shape narrower than 0.01 pt, a hairline hole, the edge and work limits, a long thin shape, no area) and `cmd::addons::pathtools::inscribed::tests` in `vectorcraft-engine`. Commands: `docs/mcp.md` › Path Precision Tools add-on.
|
||||
A VectorCraft addition, so no area score moves. Object › Plug-ins › Path Precision Tools › Add Inscribed Circle (`addon.pathtools.inscribedCircle`) draws the largest live circle inside each selected closed path or compound path, centered on the shape's [pole of inaccessibility](https://en.wikipedia.org/wiki/Pole_of_inaccessibility). The rest is VectorCraft's own: the shape is first resolved under its fill rule into outer contours and holes, flattened to within 0.005 pt and searched in square cells best first, and the radius is measured from the center to the curves, within 0.02 pt of the largest (when the filled area's box is less than 10 pt across, within a five-hundredth of its narrower side), and the circle is then drawn 0.03% smaller, by as much as its four curves reach past a true circle, so it stays inside. The searches of one command share one work limit. The circles use the current paint, go on top of the current layer or the isolated group (inside an isolated compound path they join it and take its appearance), and are one undo step (#6966). Open paths, other objects, shapes that fill no area, and outlines past 262,144 anchors or flattened pieces or the search's limits are errors. Tests: `addons::pathtools::inscribed::tests` in `vectorcraft-pathops` (a square, a concave shape, a ring under both fill rules, overlapping subpaths, a small shape, a shape narrower than 0.01 pt, a hairline hole, a small area left by the fill rule, the edge and work limits, a shared work limit, a long thin shape, a long rectangle, a fill far smaller than the precision, a lens and a bowed strip thinner than the flattening tolerance, the cell limit, no area), `cmd::addons::pathtools::inscribed::tests` in `vectorcraft-engine` and `addons::pathtools::tests` in `vectorcraft-ui-egui` (`add_inscribed_circle_draws_its_circles_without_a_dialog`). Commands: `docs/mcp.md` › Path Precision Tools add-on.
|
||||
|
||||
## Path Precision Tools add-on: Expand Dashes into Paths (2026-11-01)
|
||||
|
||||
|
||||
+1
-1
@@ -559,7 +559,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Smooth Bridge… (Radius as a percentage of the smaller circle's radius, or with Constant Gap that radius plus a gap; Reach; Keep Originals; Preview) joins two selected circles into one outline with two concave arcs that touch both circles, or three or more each to the others within reach, united where the bridges connect, in place of the circles or above them (a pair within reach gets no bridge when its arcs would not reach both circles or would cross, or when its neck would be thinner than the precision its shape is united at; a circle bridged to no other stays as it is); one undo step | done | `addon.pathtools.bridge`, `crates/pathops/src/addons/pathtools/bridge.rs`, `crates/ui-egui/src/addons/pathtools/bridge.rs` and their tests; a VectorCraft addition, so it is not scored |
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Tangent Circle… draws the circles that touch two selected paths or compound paths at a radius, or three of them, each touching the outlines without crossing them; Radius (two shapes), a Circle menu (All or one by number) and Preview; one undo step | done | `addon.pathtools.tangentCircle` (in `crates/engine/src/cmd/addons/pathtools/tangent_circle.rs`, geometry in `crates/pathops/src/addons/pathtools/tangent_circle.rs`) and its tests; a VectorCraft addition, so it is not scored |
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Add Bounding Rectangle… and Add Bounding Circle… draw a live rectangle on the selection's geometric bounding box, or the smallest live circle that holds its outlines, from a dialog with Offset, One per Object (a shape around each object instead of one around the whole selection) and Preview; one undo step | done | `addon.pathtools.boundingRectangle` and `addon.pathtools.boundingCircle` (in `crates/engine/src/cmd/addons/pathtools/bounding.rs`, the circle in `crates/geom/src/shapes.rs`, `enclosing_circle`; the dialog is the command dialog, `crates/ui-egui/src/dialogs/command.rs`) and their tests, with the menu items' test `add_bounding_rectangle_and_circle_open_a_dialog_with_offset_and_one_per_object` in `crates/ui-egui/src/addons/pathtools/tests.rs`; a VectorCraft addition, so it is not scored |
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Add Inscribed Circle draws the largest live circle inside each selected closed path or compound path, in the area it fills under its fill rule; one undo step | done | `addon.pathtools.inscribedCircle` (in `crates/engine/src/cmd/addons/pathtools/inscribed.rs`, geometry in `crates/pathops/src/addons/pathtools/inscribed.rs`) and its tests; a VectorCraft addition, so it is not scored |
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Add Inscribed Circle draws the largest live circle inside each selected closed path or compound path, in the area it fills under its fill rule; one undo step | done | `addon.pathtools.inscribedCircle` (in `crates/engine/src/cmd/addons/pathtools/inscribed.rs`, geometry in `crates/pathops/src/addons/pathtools/inscribed.rs`) and its tests, with the menu item's test `add_inscribed_circle_draws_its_circles_without_a_dialog` in `crates/ui-egui/src/addons/pathtools/tests.rs`; a VectorCraft addition, so it is not scored |
|
||||
| Path Precision Tools add-on (VectorCraft addition): Effect › Path Effects lists its live effects (Dashes to Geometry, Add Anchors, Extend Path, Close Path, Smooth Anchors, Retract Handles, Reverse Direction, Simplify Anchors, Split at Anchors), each with the effect dialog's live Preview except Reverse Direction, which has no options, and listed in the Appearance panel like any effect | done | `addon.path.*`, `crates/effects/src/addons/path.rs`, `crates/ui-egui/src/addons/pathtools.rs` and their tests; not a feature of the reference app, so it is not scored |
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its four tools (Anchor Eraser Brush, Extend Path, Measure & Inspect, Parametric Shape), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and the Parametric Shape panel (kind, count, W/H, rotation, the kind's own values and corner radius of the selected parametric shape, or of the tool's next one), and runs Add Points at / Split at Crossings and Convert to Parametric Shape; the Parametric Shape Tool draws ten re-editable kinds from the centre (↑/↓ and ←/→ change their numbers while dragging) and edits a selected one with handles; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs`, `crates/ui-egui/src/addons/pathtools/shape.rs` and their tests; not a feature of the reference app, so it is not scored |
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its six tools (Anchor Eraser Brush, Extend Path, Measure & Inspect, Parametric Shape, Corner Tool, Slide Anchor Along Path), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and the Parametric Shape panel (kind, count, W/H, rotation, the kind's own values and corner radius of the selected parametric shape, or of the tool's next one), and runs Add Points at / Split at Crossings and Convert to Parametric Shape; the Parametric Shape Tool draws ten re-editable kinds from the centre (↑/↓ and ←/→ change their numbers while dragging) and edits a selected one with handles; the Corner Tool cuts editable corners on any path (hover shows the anchor, a click uses its radius and kind, a drag sizes the corner, Shift whole values; a corner's marker selects it and loads its values, drags to resize, to 0 or double-clicked removes it; never past what fits; Alt-marquee cuts every anchor inside) with a Corners section in the Anchor Inspector (radius, kind, selected count, Apply to Selected Anchors); Slide Anchor Along Path drags an anchor along its curve with the segments beside it refitted, Shift snapping where the tangent is a multiple of 45°; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs`, `crates/ui-egui/src/addons/pathtools/` and their tests; not a feature of the reference app, so it is not scored |
|
||||
|
||||
Reference in new issue
Block a user