intersect_cubics panicked in clamp ("min > max") when either curve ran
from a larger y to a smaller one. It now compares such a curve as the
same curve with its control points reversed.
A negative or zero sure_tolerance, or a negative ish_tolerance, could
panic on an unwrap, overflow the stack on identical curves, or report
two parallel lines one unit apart as Right. With a sure_tolerance that
is not positive or is larger than ish_tolerance, or an ish_tolerance
that is not finite, the comparison now returns Ish over the common
range. Curves whose vertical ranges do not overlap give an empty order
instead of failing a debug assertion.
Topology::bounding_box returns Rect::ZERO when there are no segments,
as kurbo does for an empty path, instead of a rectangle from infinity
to negative infinity.
The docs of solve_t_for_y, y_subsegment and from_monotone_cubic state
their input rules and what happens outside them. README.craft.md,
SOURCE.json and NOTICE record the local patch.
TreeVec's iter, iter_mut, range and range_mut kept the iterator's stack of
child iterators in a Vec, so each call on a tree with more than one level
allocated once. The sweep line calls range_mut on a TreeVec<_, 128> while
it holds more than 128 segments.
The stack is now a Stack that holds 8 levels in place and puts any deeper
level in a Vec. A TreeVec<_, 128> needs at least 2 * 64^9 elements to have
more than 8 levels. The iterators visit the same elements in the same
order. The treevec test iterators_on_short_and_tall_trees compares the
four iterators with a Vec on a tree of at most 8 levels and on one with
more.
README.craft.md, SOURCE.json and NOTICE record the change as a local patch.
Topology::is_disjoint_tags called dbg!(touches1, touches2) for every
output segment, which writes two lines to stderr per segment on every
call, in release builds too. It also looped over every winding entry,
including the segments deleted when coincident segments were merged.
Remove the dbg! call and loop over segment_indices(), which skips the
deleted segments. Record the local patch in README.craft.md,
SOURCE.json and NOTICE.
When many segments end at one sweep height while others start there, each
new segment's scan walked the whole run of ending segments with one indexed
tree lookup per segment. Both scans now step over such a run with one pass
of a TreeVec iterator; TreeVec::range_rev_to provides the reverse pass for
the left scan. The scans compare the same segments and push the same events.
Topology allocated an output segment for every active horizontal piece at
every point of a sweep line, and merge_coincident deleted the duplicates
afterward. n rectangles rect(i, 0, i + n, 10) gave 2n^2 + 2n output
segments, of which 6n - 2 survived. process_sweep_line_range now
allocates one output segment for each run of coincident pieces, with the
winding numbers on either side of the run, and none for a run whose
winding numbers cancel. The contours do not change.
has_normal_contours judges every piece of a run by the winding numbers on
either side of the run. Before, it also read the winding numbers between
the pieces, so its answer depended on their order: two squares that share
a horizontal edge were not normal, and a horizontal spur out of a square
and back was normal on one side of the square and not on the other.
is_disjoint_tags reads the winding numbers on either side of a run. The
slow-asserts continuity check includes the pieces without an output
segment. README.craft.md, SOURCE.json and NOTICE record the local patch.
Exact copies of a shape queue a touch event for every pair of coincident
segments, and the touch branch of Sweeper::handle_intersection scanned
the whole bundle in both directions for each one. Sweeping n copies took
time growing faster than n^3: 200 copies of a 4-point polygon took 3.9 s
and 400 copies took 98 s in a release build.
The touch branch now runs its scan right or left from a segment at most
once per sweep line until the sweep-line order changes. A repeated scan
reads the same order, y and segments and would only push events already
queued, so the output does not change. README.craft.md, SOURCE.json and
NOTICE record the change as a local patch.
When the contour walk in Topology::contours returns to a point it already
visited, it cut the loop out and always made it a child of the walked
contour with the opposite outer flag. That is right for a hole touching
its outer contour, but not for two holes touching at a point: in a
100x100 square with holes [10,30]x[30,50] and [30,50]x[50,70], the
second hole came out with outer = true and the first hole as its
parent, although it winds counter-clockwise.
The walk now keeps the loops and sorts all pieces after it ends. A piece
that winds like the walked contour is its sibling; a piece that winds
the other way is a child of the piece that contains it. The orientation
is measured from each piece's own corner so that large coordinates do
not flip its sign. README.craft.md, SOURCE.json and NOTICE record the
local patch.
Topology::merge_coincident merged a segment only with the west neighbor
recorded when the segment was created. After an earlier merge deleted
that neighbor, the next coincident copy failed the check, so a run of
coincident segments merged only in pairs. Four copies of one square,
two in each direction, have winding number zero everywhere, but they
left 4 output segments, and contours with the nonzero rule returned 2
zero-area contours instead of none. binary_op with Union gave the same
2 contours.
merge_coincident now skips west neighbors that an earlier merge deleted
and compares the segment with the nearest live one. README.craft.md,
SOURCE.json and NOTICE record the local patch.
merge_coincident_runs_longer_than_two checks that the four-copy input
leaves no segments and no contours, and that three copies (two in one
direction, one in the other) leave the square once. Without the change
it fails with 4 live segments.
A BezPath deserialized from [ClosePath] or
[ClosePath, MoveTo, LineTo, LineTo, ClosePath] made Topology::from_path
and binary_op panic in kurbo with "Can't start a segment on a
ClosePath". add_path_without_updating_enter_exit and the bounding box in
binary_op now skip a ClosePath that comes before the first point.
README.craft.md, SOURCE.json and NOTICE record the local patch.
Contours::grouped walked each containment tree with a recursive visit,
one call per nesting level. Contours nested about 10,000 deep, such as
20,000 nested squares filled with the even-odd rule, overflowed a 1 MiB
stack (STATUS_STACK_OVERFLOW on Windows). A stack overflow aborts the
process, so catch_unwind in craft-prepress cannot stop it.
grouped now walks each tree in pre-order with an explicit stack and
returns the contours in the same order as before. README.craft.md,
SOURCE.json and NOTICE record the local patch.
grouped_lists_each_tree_in_pre_order checks the order on two trees with
siblings. grouped_handles_deep_nesting_on_a_small_stack calls grouped on
30,000 nested contours on a thread with a 256 KiB stack; without the
change it aborts with a stack overflow.
Topology::from_path and binary_op panicked on a cubic with a coordinate
above about f64::MAX / 3, for example M0,0 C(y/4,y) (y/2,y) (y,y) L(0,y) Z
at y = 7e307. kurbo's subsegment overflows there and returns NaN control
points, and f64::clamp in from_monotone_cubic panicked with "min > max,
or either was NaN".
The Topology constructors that take Bezier paths now check every point
first and return Error::NaN, Error::Infinity or the new Error::TooLarge
for a coordinate that is not finite or has a magnitude above
MAX_COORDINATE (f64::MAX / 16). Their error type changes from
NonClosedPath to Error, which already wraps it. binary_op returns
Error::TooLarge through from_paths_binary.
README.craft.md, SOURCE.json and NOTICE record the local patch.
Sweeper::handle_intersection delays an intersection when a segment
between the pair compares out of order, and queued the delayed event at
y1.min(y2) without checking the segments' ends. When that y was the end
of one of the two segments, handling the event there panicked in
CurveOrder::entry_at, which finds no order entry ending after y.
The delayed event is now queued only when its y is before the ends of
both segments, the same rule the intersection scans use.
The delayed_intersection_at_a_segment_end test sweeps three wide, flat
contours (x up to 1e12, y below 1e-3) through Topology::from_path and
expects 4 contours; without the change it panics at
src/curve/mod.rs:357. README.craft.md, SOURCE.json and NOTICE record
the change as a local patch.
When the sweep leaves winding numbers that disagree around a point, the
contour walk in Topology::contours never ends in a build without debug
assertions. For "M4,-1 C8,1 -7,-2 5,8 L-4,-8 L2,1 L1,1 Z" the scan
around a point finds no boundary segment and turns forever; for a
four-subpath input the walk circles without reaching its start and adds
a contour on every lap until memory runs out.
The walk now panics with "inconsistent winding numbers" when the scan
comes back to its first neighbor or the walk re-enters a segment it
already walked. README.craft.md, SOURCE.json and NOTICE record the
local patch.
craft-prepress catches that panic: Arrangement::regions returns
GeomError::Degenerate, and nonzero keeps an even-odd path as it is.
When nearly coincident segments do not compare transitively, handling
one intersection queued another pair at the same y again, and the pairs
cycled forever through the same positions while segs_needing_positions
grew. Five circles of radius 50, each moved by (7e-7, 3.5e-7), hang
Sweeper::next_line this way.
next_line now handles a pair at most once per sweep line for each pair
of positions the two segments hold. A repeat is queued at the pair's
next order change instead, when that comes before both segments end.
The repeated_intersections_at_one_y test sweeps the five circles. Test
builds panic after n^4 intersection events on one sweep line, so the
test fails instead of hanging without the change. README.craft.md,
SOURCE.json and NOTICE record the change as a local patch.
tests/paperjs.rs reads its cases from boolean-test/data/, which the 0.5.0
package does not include. It skipped any file it could not load, so the
paperjs target ran 0 trials and passed. A file that cannot be loaded now
becomes a failing <operation>/load trial, and load_errors_are_reported
checks that a missing file produces one. README.craft.md, SOURCE.json and
NOTICE record the change as a local patch.
`pixmap_distance` in `tests/paperjs.rs` compared only red, green and
blue. The test fills both shapes with opaque black on a transparent
pixmap, so a covered pixel and an empty one have the same color and the
distance was 0 for any result. The distance now also counts the alpha
difference, and `pixmap_distance_counts_coverage` checks that a filled
pixmap and an empty one are at distance 1.
`scripts/test-pdf-backends.sh` and `README.craft.md` run the `paperjs`
test as well. The package does not include the `boolean-test/data/`
files the test reads, so here it runs only the new test.
The change is recorded in `SOURCE.json`, the Local changes table in
`README.craft.md` and `NOTICE`.
TreeVec's normalize_bounds added 1 to an excluded start and an included
end without a check, and did not compare the start with the end. In a
debug build, range((Excluded(usize::MAX), Unbounded)) overflowed at the
addition, and range(10..5) on a tree with internal nodes overflowed at
end - start; in a release build both wrapped. range and range_mut now
panic with a message for a bound past usize::MAX or a start after the
end. The tests range_reversed, range_mut_reversed, range_start_past_max
and range_end_past_max in treevec.rs fail without the change.
README.craft.md, SOURCE.json and NOTICE record the change.
choose_cross_height took the midpoint of a crossing's height range as
(y0 + y1) / 2.0. For heights above about 9e307 the sum overflows, so a
range from 1e308 to 1.5e308 gave an infinite crossing height instead of
1.25e308. It now uses f64::midpoint, which gives the same result as
before for smaller heights.
The cross_height_near_f64_max test checks that range for a crossing and
a touch. README.craft.md, SOURCE.json and NOTICE record the change as
the copy's first local patch.
lem-intersection-height-error defined t as the ending gap
alpha(y_1) - beta(y_1) over the sum of both gaps. The gap
beta - alpha between two segments is D0 (1 - t) - D1 t, which is zero
at t = D0 / (D0 + D1), with D0 = beta(y_0) - alpha(y_0) the starting
gap. With D0 = 1 and D1 = 3 the old formula gave t = 0.75, while the
segments cross at t = 0.25. The code in src/curve/line.rs already
divides the starting gap.
The lemma and its proof now use the starting gap as the numerator c,
which also matches the proof's alpha(y) - beta(y) = -c + s d.
SOURCE.json records the patch in local_patches and the new sha256 of
docs/sweep.typ. README.craft.md and NOTICE say one file is changed.
When CurveOrder::push follows a Left or Right interval with the opposite
order, it inserts an Ish entry between them. The code's comment says that
entry has zero height, but the package ended it at the new interval's end,
so Ish covered the whole new interval and the new order covered none of
it. Pushing Right to 1 and then Left to 2 gave
[(0,1,Right), (1,2,Ish), (2,2,Left)], and order_at(1.5) returned Ish.
The Ish entry now ends where the earlier interval ends, giving
[(0,1,Right), (1,1,Ish), (1,2,Left)]. README.craft.md lists the change
in a Local changes table, SOURCE.json records it in local_patches with
the new hash of src/curve/mod.rs, and NOTICE says the copy has one
local patch.
Segments::add_points made a segment from every pair of neighboring points,
so add_points([(0, 0), (0, 0), (1, 1)]) added a zero-length segment and
check_invariants failed on it at assert_ne!(seg.start(), seg.end()). It now
skips a point equal to the one before it, as add_closed_polyline already
does. The test segments::tests::add_points_skips_repeated_points fails
without the change.
README.craft.md, SOURCE.json and NOTICE record the change.
The example's binary_op call uses FillRule::EvenOdd, but it drew the two
input paths without a fill-rule attribute, so SVG viewers filled them with
the nonzero default. A path with a hole wound the same way as its outer
contour was drawn solid while the operation treated the hole as empty.
The input paths now carry fill-rule="evenodd", taken from the rule the
operation uses. scripts/test-pdf-backends.sh runs the example's tests, and
README.craft.md, SOURCE.json and NOTICE record the change.
The package's Cargo.toml registers the fonts and snapshots tests, the
boolean_op and winding-numbers examples and the linebender_logo bench.
They import linesweeper_util, path_bool or kompari, which the published
manifest leaves out, and the bench also reads examples/linebender.svg,
which the copy omits. `cargo check --all-targets --all-features` in
vendor/linesweeper failed with E0432 and a missing-file error.
The copy's Cargo.toml no longer registers those five targets; their
source files are unchanged. scripts/test-pdf-backends.sh now runs
`cargo check --locked --all-targets --all-features` on the copy.
README.craft.md, SOURCE.json and NOTICE record the change.
line_at_ys multiplied each y offset by the reciprocal of the line's
height. For a height below about 5.6e-309 the reciprocal is infinite,
so intersect_lines on two vertical lines 1e-310 tall computed NaN x
positions and failed its z0 >= z1 debug assertion. It now divides each
offset by the height.
The subnormal_span test compares two such lines. README.craft.md,
SOURCE.json and NOTICE record the change as the copy's first local
patch.
The pseudocode for the intersection scan to the left looped j = i down
to 1 and compared each alpha^j with alpha^i, so its first pass compared
alpha^i with itself. The lemma after it is stated for alpha^(i+1), the
segment being inserted to the right of alpha^i. The loop body now uses
alpha^(i+1), and w^j is the smallest event height between j and i+1.
SOURCE.json records the patch in local_patches and the new sha256 of
docs/sweep.typ. README.craft.md and NOTICE say one file is changed.
Add the linesweeper 0.5.0 package to vendor/ with no file changed, so
that a fix to it can reach the Craft apps through this repository
without waiting for a linesweeper release. The GitHub repository its
manifest names is archived, and its README says development moved off
GitHub.
Leave out the test font (fonts live in craft-fonts), the logo artwork,
the snapshot images and the package's repository tooling. SOURCE.json
lists each with its hash.
Add a workspace exclude, a [patch.crates-io] entry, SOURCE.json with
the archive hash and per-file hashes, NOTICE and ATTRIBUTION.md rows,
and the package's tests in the backend test script. craft-prepress's
flatten feature now builds against the copy, so Cargo.lock drops the
package's registry source and checksum.