Commit Graph
199 Commits
Author SHA1 Message Date
dotCooCoo da4cc3e9f9 Merge main into feat/inscribed-circle 2026-11-24 13:39:51 -08:00
dotCooCoo 70a56fb5be 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.
2026-11-21 23:53:37 -08:00
BFlat f03d04b91b Merge pull request #8996 from dotCooCoo/fix/simplify-smooth-keep-closed-start
Paths: Object > Path > Simplify and Smooth keep a closed path's start
2026-11-22 11:38:13 +07:00
BFlat b37556d626 Merge pull request #8913 from dotCooCoo/fix/point-tangents-close-samples
Path Precision Tools: Common Tangents keeps both lines from a point close to a round path
2026-11-22 10:44:06 +07:00
dotCooCoo 80f96d11f9 Path Precision Tools: Add Inscribed Circle draws the largest circle inside a path
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 its pole of
inaccessibility. Part of #6966.

- The outline is resolved under its fill rule into outer contours and
  holes, so overlapping subpaths count as the area they fill and holes
  bound the circle down to 1e-6 pt wide, the path operations'
  resolution. Square cells are searched best
  first, and the radius is measured from the center to the curves:
  within 0.02 pt of the largest, or a thousandth of the narrower side
  for a shape less than 10 pt across.
- 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 where it touches.
- Open paths, other objects, shapes that fill no area, and outlines past
  262,144 flattened pieces or the search's work limit are errors that
  leave the document unchanged. The first cells are sized to the work
  limit.
- The circles get the current paint, go on top of the current layer or
  the isolated group, and are one undo step.
- Docs: docs/mcp.md, docs/target-app-parity.md, docs/ui-parity.md,
  ROADMAP.
2026-11-21 18:49:56 -08:00
dotCooCoo 8e6f06574f Paths: a closed path starts at a kept anchor at its old start
When the refit keeps an anchor at a closed path's old start, Simplify
and Smooth now start the path at that anchor, even where a segment of
the refit crosses the path at the same point. Before, a crossing
segment that came first could be split there instead, adding an anchor
and changing the segment the path starts along.
2026-11-21 02:49:58 -08:00
dotCooCoo 263718ffd2 Paths: a run across a closed path's start keeps the new start on that run
When a direct-selected run holds a closed path's first anchor, Simplify
and Smooth now look for the new start on that run alone, so an
unselected segment that passes through the old start is not split.
When the first anchor stays, the path already starts there and is left
as it is.
2026-11-21 01:58:10 -08:00
dotCooCoo 956a76baa6 Paths: tied start candidates at one point search the old path once
When several refit points tie for nearest to a closed path's old start,
the earliest-along-the-path tie rule now places each distinct point on
the old path once, so many segments meeting at one point no longer
search every old segment once each. The tie rule is unchanged. Also
"the same way around" in the docs.
2026-11-21 01:36:06 -08:00
dotCooCoo 38e36aeb81 Paths: Object > Path > Simplify and Smooth keep a closed path's start
Simplify and Smooth refit a closed path from its first corner and kept
that order, so the path's first anchor moved and its dashes started
somewhere else. A refit now starts at the old first anchor when it keeps
one there, otherwise at a new anchor where the refit passes nearest that
point while the result still has fewer anchors than the path had, and
otherwise at the refit's nearest anchor. Its direction stays the same.
A direct-selected run across the start follows the same rule; before,
the path started at the run's end anchor.

The Smooth tool's start_nearest moves into vectorcraft-pathops, and both
commands call it with the limit on anchor count above.
2026-11-21 01:00:16 -08:00
dotCooCoo bd3f69f233 Path Precision Tools: Common Tangents finds a run's sample by binary search
The touching-run search looked up the sample before each angle with a
linear scan over the run, so a long run of samples within the tolerance
cost time in proportion to the square of its length. It now collects the
run's sample angles once and uses partition_point, which gives the same
sample at every angle.
2026-11-20 20:09:25 -08:00
dotCooCoo 320c4d4146 Path Precision Tools: Common Tangents keeps both lines from a point close to a round path
When two or more neighboring sampled normal angles all came out within the
touching tolerance, the root search took the run as one place where the
outlines touch and returned a single line at its middle. A point just
outside a circle, with both of its tangents on neighboring samples, then
got one line that misses the circle instead of two.

The search now looks between each pair of those samples for a value that
leaves the tolerance, and finds the roots between those places: a crossing
where the sign changes, a dip where it does not. A run that stays within
the tolerance, as at a corner, still gives one line.
2026-11-20 19:29:36 -08:00
dotCooCoo f4b114ae78 Path Precision Tools: check each place along the first segment once
When the same segment appears more than once among the second segments,
its roots were found once per copy, and each copy's places were checked
against every second segment. The sorted places now drop exact repeats
before they are checked. Places that differ, however close, are all kept,
so the circles found do not change.
2026-11-20 19:16:06 -08:00
dotCooCoo 7884babf0a Path Precision Tools: the Tangent Circle Tool finds both circles where two second segments touch close together
With a radius, each second segment is searched on its own, and each
circle is then checked against all of them. Before, one search over the
nearest of the second segments found one circle where two segments
touched circles between the same two places tried along the first
segment, so the tool could not pick the other.

Follows #8526.
2026-11-20 16:00:24 -08:00
bflatastic a383279b73 Merge remote-tracking branch 'origin/main' into fix/7766
# Conflicts:
#	crates/ui-egui/src/dialogs.rs
#	docs/mcp.md
2026-11-19 23:15:56 +07:00
BFlat 5ec0c715b1 Merge pull request #8607 from dotCooCoo/fix/followup-8030
Smooth Bridge: count the bridge limit after thin necks are dropped
2026-11-19 15:03:58 +07:00
dotCooCoo 96a4c8a881 Merge main into feat/pathfinder-effect-options 2026-11-18 18:49:46 -08:00
dotCooCoo 3a32a8c600 Smooth Bridge: count the bridge limit after thin necks are dropped
Bridging many circles refused a selection with more than 8000 pairs
within reach before the necks too thin for the shape's precision were
dropped, so a selection that leaves fewer than 8000 bridges was refused.
The 8000 limit now counts the pairs that are left; the bound on the
candidate pairs to check stays.

The progress doc no longer says two circles are bridged at any
distance: Reach does not limit them, but the radius can still be too
small to bridge them.
2026-11-18 13:27:15 -08:00
dotCooCoo a9cd206c04 Merge main into feat/tangent-circle-tool 2026-11-18 13:19:09 -08:00
dotCooCoo a0873e4bf1 Merge main into feat/smooth-bridge-many 2026-11-18 08:14:05 -08:00
dotCooCoo 602ecb9786 Merge main into feat/tangent-circle-tool 2026-11-18 06:02:18 -08:00
BFlat ff0f7dcac5 Merge pull request #8506 from dotCooCoo/feat/point-tangents
Path Precision Tools: Common Tangents draws the lines from a point to a closed path
2026-11-18 18:25:50 +07:00
dotCooCoo 87abf8b66b Merge main into feat/pathfinder-effect-options 2026-11-18 01:36:33 -08:00
dotCooCoo b7af9a7e6b Merge main into feat/tangent-circle-tool 2026-11-18 01:32:50 -08:00
dotCooCoo 1d9ba0dc0a Path Precision Tools: state when a point counts as on the outline
A point counts as on the path's outline when it is less than the
touching tolerance from it, with its distance from the path's center in
place of the distance between centers. The params text, docs/mcp.md and
the progress doc now say so, and say that every Tangents choice in the
dialog gives the same lines for a point.

Tests: a point half the tolerance inside and outside a circle gets the
one line there, and farther off gets none or two; a point placed on a
turned outline gets a line as long as the outline is wide along it; the
dialog previews the same two lines for every Tangents choice and keeps
them as one step, and a point inside changes nothing and says why.
2026-11-17 22:39:13 -08:00
dotCooCoo 6645c7f487 Path Precision Tools: a canceled press keeps the Tangent Circle Tool's first segment
- A canceled press on the second segment (a canceled touch, a second
  finger) draws nothing and leaves the first segment picked. A canceled
  press that picked the first segment leaves no segment picked. Before
  this change a canceled press worked as Escape and forgot the first
  segment.
- Shift pressed or let go during a click on the second segment, before
  the pointer moves far enough to start a drag, counts at the release:
  the circle is looked for again with or without the tool's radius.
- A session test sends the tool's release with a command that fails and
  checks that the first segment stays picked.
- The radius option's test checks that a value outside 0.01 to 1000000,
  or one that is not a number, leaves the radius as it is.

Docs: docs/target-app-parity.md lists every kind of circle the tool
leaves out: circles whose nearest point on the second segments is not on
the circle, circles that cross the first segment, circles that touch
both segments at one point, circles without a finite radius above 0, and
circles too small or too large for three of their points to give them
back. A circle found twice is kept once. docs/mcp.md says that in a
drag the circle touching nearest the press is drawn, and that the
radius option is not checked yet.

Part of #7178.
2026-11-17 22:20:58 -08:00
dotCooCoo 51194f584b Path Precision Tools: the Tangent Circle Tool keeps its first segment until the circle is drawn
- The release returns shape.circleThroughPoints followed by a Notify,
  and the tool forgets the first segment only when it is told, so a
  command that fails leaves the segment picked (as the Direct Selection
  tool's FRAME_PICKED notice follows its command).
- The preview leaves out circles that three of their points cannot give
  back, so the note shows where a click would draw nothing.
- A double-click draws nothing more: the canvas sends it after the
  second click's release, which drew the circle.
- The re-exports for the tool are a separate `pub use` in the pathops
  pathtools module, whose module comment is unchanged.
- Circles of one radius at places tried close together along the
  first segment are no longer taken for repeats: a repeat also touches
  the first segment at the same point. At a radius of 1,000,000 pt the
  513 places along a 100 pt line were cut to 86.
- A test checks the note's row in every complete catalog.

Docs: a drag's circle may touch the first segment anywhere along it;
the circles that are left out; an out-of-range radius option leaves
the radius as it is. The ROADMAP, target-app-parity and ui-parity
entries move next to related entries, and docs/mcp.md is rewrapped to
120 columns.

Part of #7178.
2026-11-17 21:16:04 -08:00
dotCooCoo 6a3a7ad704 Path Precision Tools: test a point placed on a turned outline
A point worked out on an outline lies a rounding error inside or outside
it. The new test places a point at 37 angles on a turned ellipse, and on
each anchor and three places along each segment of a turned and moved
Bezier circle, and checks that each gets exactly one line through it.
2026-11-17 20:50:30 -08:00
dotCooCoo a561f666a6 Path Precision Tools: the Tangent Circle Tool draws a circle on two clicked segments
The Tangent Circle Tool (tangentCircle) joins the add-on's tools, in
Object > Plug-ins > Path Precision Tools and the All Tools drawer. A click
on a path segment picks it; a click on a second segment draws the circle
that is tangent to the first segment at the point clicked and touches
the second. The segments beside the second one count with it, and of
the circles found the one touching them nearest the pointer is drawn.

- Shift on the second click uses the tool's radius (36 pt to start, set
  in its options), anywhere along the first segment.
- A drag from the second segment sets the radius to the drag's length;
  Shift steps it by 1, 2 or 5 times a power of 10 pt, at least 4 screen
  pixels, and Cmd/Ctrl pressed during the drag moves it by a tenth.
- Before the click the circle shows with its center, its radii to the
  touch points and its radius, or a translated note says there is none.
  The preview follows a pan, a zoom or an edit under a still pointer.
- The circle is drawn with shape.circleThroughPoints, so Align New
  Objects to Pixel Grid leaves it tangent; one undo step. A circle that
  its three points cannot give back in floating point is not drawn, and
  the first segment stays picked. Escape, an edit outside the tool or
  another document forgets the first segment.

The geometry is circles_through and circles_of_radius in the pathops
crate: the distance to the second segments is sampled along the first
segment's normal (or along the segment, for a radius) and the places
where it equals the radius are taken, including touches between samples.

Part of #7178.

Docs: docs/mcp.md, docs/ui-parity.md, docs/target-app-parity.md, ROADMAP.
2026-11-17 20:04:15 -08:00
dotCooCoo d89f6b72c4 Merge main into feat/smooth-bridge-many 2026-11-17 19:59:55 -08:00
dotCooCoo 46776a81ca Path Precision Tools: Smooth Bridge keeps huge circles' outlines finite
The bridge's distance and arc-center math no longer squares lengths, so
circles larger than about 1e154 pt are bridged instead of refused, and
an outline that would not fit in f64 is refused instead of written with
non-finite anchors.
2026-11-17 18:38:11 -08:00
dotCooCoo 21e0b780e7 Path Precision Tools: Common Tangents draws the lines from a point to a closed path
Common Tangents (addon.pathtools.commonTangents) now also takes a point,
a path of one anchor, together with a convex closed path. The lines run
from the point to where they touch the path: two from a point outside
it, one from a point on its outline (centered on the point and as long
as the path is wide along it, or the whole straight side the point lies
on), and none from a point inside, which leaves the document unchanged
and returns a warning. Centerline adds the line from the point to the
path's center. Every Tangents value gives the same lines; two points
are refused.

The geometry treats the point as an outline whose support value is
p . n, so the existing root search finds the lines.

Docs: docs/mcp.md, docs/target-app-parity.md, ROADMAP. The new warning
has a row in every catalog.
2026-11-17 18:03:55 -08:00
dotCooCoo 38a178154b Merge main into feat/smooth-bridge 2026-11-17 17:38:12 -08:00
BFlat 40f1080a86 Merge pull request #8215 from dotCooCoo/fix/trim-line-end-on-curve
Path Precision Tools: a path that ends on a curve still divides it after the curve is cut
2026-11-18 03:20:13 +07:00
dotCooCoo 66f805f098 Merge main into feat/pathfinder-effect-options 2026-11-17 08:06:49 -08:00
dotCooCoo b963e41e85 Merge main into feat/smooth-bridge-many 2026-11-16 22:14:28 -08:00
dotCooCoo 9ddfc2e00f Path Precision Tools: shallow crossings are placed where the paths meet
The crossing search splits curves into pieces until each lies within
0.0001 pt of its chord, and takes the place where two chords cross.
Where a line meets an arc at under a degree, that place sat up to
0.025 pt along the arc from the real crossing, so Trim at Crossings,
its hover and Add Points at Crossings cut there.

Each place found is now moved onto both curves with Newton's method on
a(s) = b(t). The move is kept only when it stays within both segments,
ends closer than 1e-9 pt, and moves no farther than a piece bent by
0.0001 pt can shift a crossing at that angle; otherwise the place stays
as it was.
2026-11-16 17:42:19 -08:00
dotCooCoo 2af27232e0 Path Precision Tools: a path that ends on a curve still divides it after the curve is cut
The crossing search took a crossing only where the straight pieces it
splits two curves into actually cross. A line trimmed at a curve ends
where that search found the crossing, up to about 0.0001 pt off the
curve. Once the curve was cut as well, its segments were split
differently, the line's end could fall just short of them, and the end
no longer counted as a place on the curve. Trim at Crossings then
removed the curve past that line, to the next crossing or the whole
path.

An open end of a path that lies within 0.001 pt of another path now
meets it at the nearest point there, at any angle. Corners of a path
and closed paths keep the exact test, and paths that lie along each
other still don't cross. Trim at Crossings and its hover, Add Points
at Crossings (with and without cut) and the Join tool's trim and join
of crossing paths use this search. The params text of Trim at
Crossings and Add Points at Crossings and docs/mcp.md say so.
2026-11-16 11:22:22 -08:00
BFlat 36c1f37ac6 Merge pull request #8096 from dotCooCoo/feat/packaging-check-fold-lines
Packaging Tools: Check Fold Lines finds the panels and hinges of a blank and lists what is wrong
2026-11-16 23:08:07 +07:00
dotCooCoo 532d2ea6d7 Packaging Tools: Check Fold Lines finds the panels and hinges of a blank and lists what is wrong
Object › Plug-ins › Packaging Tools › Check Fold Lines, and the Fold Lines
panel's Check button, check the fold lines of the selection, or of the
document while nothing is selected (`addon.packaging.check`).

- Cut lines bound the material: each connected piece that encloses an
  area is one blank, its largest closed cut line is the outline, and a
  closed cut line inside it is a hole. A slot drawn as a rectangle across
  the outline leaves the same material as a notch drawn in it, and an
  outline drawn as several open cut lines works too.
- Creases, partial cuts and perforations divide a blank into panels; the
  pieces between the same two panels form one hinge.
- 15 issue codes, errors and warnings, each naming its lines; cut line
  ends within a tolerance (0.1 pt, 0.01 to 10) are joined and reported as
  a gap. With `select`, the lines the issues name are selected.
- The panel lists the issues in the interface language, with a summary
  line; clicking an issue or its Select button selects its lines. The
  list is kept until the document changes.

`vectorcraft_pathops::adjacency` maps paths as live_paint does and keeps,
for each edge, every input it lies on and the faces on both sides; the
blank model is `vectorcraft_three_d::fold::blanks`. The engine now depends
on vectorcraft-three-d directly.

Docs: docs/mcp.md (Check Fold Lines), crates/pathops/README.md, ROADMAP.
2026-11-16 01:47:15 -08:00
dotCooCoo 4781fac16e Path Precision Tools: Smooth Bridge suggests a larger radius only when it bridges among the other circles
With three or more circles and no pair that can be bridged, the error
suggested a larger radius or gap when the largest one bridged a single
pair on its own, even when that pair's neck was still too thin to unite
among the other circles. The suggestion now uses the same rules as the
many-circle bridge (`bridges_any` in `vectorcraft-pathops`).

The command's params text, `docs/mcp.md` and `docs/ui-parity.md` now say
that a pair within reach also gets no bridge when its neck would be
thinner than the precision its shape is united at.
2026-11-15 21:50:20 -08:00
dotCooCoo 3bde201d6c Path Precision Tools: Smooth Bridge reuses the tangent circle's Circle type
The bridge module defined a second Circle with the same fields and derives as tangent_circle::Circle, and pathtools re-exported the tangent one as TangentCircle. The bridge now imports the existing type, pt::Circle names it again as on main, and the tangent circle command's annotation is back to pt::Circle.
2026-11-15 21:37:21 -08:00
dotCooCoo 44051847c5 Merge main into feat/smooth-bridge 2026-11-15 20:57:30 -08:00
dotCooCoo 3050baff96 Merge main into feat/smooth-bridge-many 2026-11-15 20:52:48 -08:00
dotCooCoo dd8a50dbe3 Path Precision Tools: Smooth Bridge leaves necks too thin to unite unbridged
With three or more circles, a pair just inside the arcs' limit can have
a neck far thinner than the precision the shapes are united at, and the
union could drop it while the pair still counted as joined. Each set of
connected circles is now united at a precision fine enough for its
smallest circle, and a pair whose neck is narrower than twice that gets
no bridge, the same as a pair too far apart for the arcs.
2026-11-15 19:49:25 -08:00
dotCooCoo 83f21f4496 Path Precision Tools: Common Tangents adds the centerline between tiny paths
The centerline was left out whenever the two centers were less than 1e-9
points apart, so two separate paths a billionth of a point wide got their
tangents but no centerline. Centers now count as one point only when they
are closer than a billionth of the larger path's size.
2026-11-15 19:36:17 -08:00
dotCooCoo d487dae5b3 Path Precision Tools: Common Tangents refuses a path that turns inward at a join
The convexity check compared points sampled along each segment and the
curvature inside each segment, but not the corner where one segment meets
the next. A segment that leaves its start a little the wrong way could make
an inward corner that neither check saw. Each join is now checked by the
directions the two segments meet it in, skipping segments of no length.
2026-11-15 19:19:45 -08:00
dotCooCoo 81f8d8020d Merge main into feat/smooth-bridge-many 2026-11-15 18:51:11 -08:00
dotCooCoo 84308c53d7 Path Precision Tools: Smooth Bridge joins many circles and keeps a constant gap
Smooth Bridge now takes three or more circles. Every two whose outlines
are within a reach of each other are bridged, the bridges that connect
are united into one shape each, and a circle bridged to no other stays
as it is.

- `addon.pathtools.bridge` takes `gap` (0 to 1000 pt) in place of
  `radius`: the arcs' radius is the smaller circle's radius plus the
  gap, so each arc stays the gap away from a circle of the smaller
  circle's size about the arc's center. In a triangular grid of equal
  circles that gap apart, the channels around an empty place keep one
  width. Giving both is an error.
- `reach` (0 to 10000 pt, 10 by default) sets how far apart two circles'
  outlines may be for a bridge between them. It applies to three or
  more circles; two are bridged at any distance, and the dialog's Reach
  field is unavailable then. Pairs are found through a grid of cells,
  so each circle is compared only with its near neighbors. Holes
  smaller than 1% of the smallest circle's area are filled.
- A pair within reach but too far apart for the radius or gap gets no
  bridge. One circle inside another, no pair that can be bridged, no
  two circles within reach, more than 2000 circles and more than 8000
  bridges are refused with a message. An id given twice counts once.
- Each shape replaces its circles, painted as the topmost of them, or
  with `keepOriginals` goes directly above that circle. One undo step;
  the shapes and the circles left alone are selected, and the result is
  `{ids, alone}`, with `id` as well for two circles.
- `smooth_bridge` refuses circles whose sizes overflow when squared;
  it returned a path whose points were not numbers.
- The selection message becomes "select two or more circles to bridge".
- The dialog adds Constant Gap (a Gap field in place of Radius) and
  Reach.

Docs: docs/mcp.md, docs/ui-parity.md, docs/target-app-parity.md,
ROADMAP.
2026-11-15 18:49:45 -08:00
dotCooCoo 1041a5c528 Merge main into feat/common-tangents 2026-11-15 18:44:19 -08:00
dotCooCoo 7ff63a6cd7 Merge main into feat/line-segment-common-tangent 2026-11-15 18:40:40 -08:00