diff --git a/NOTICE b/NOTICE index 920082f80b..d967f9242c 100644 --- a/NOTICE +++ b/NOTICE @@ -283,6 +283,9 @@ vendor/linesweeper/README.craft.md and vendor/linesweeper/SOURCE.json for proven vendor/linesweeper with its upstream license files and one local patch. Its manifest names Joe Neeman as author, and its LICENSE-MIT reads "Copyright (c) 2018 Raph Levien". See vendor/linesweeper/README.craft.md and vendor/linesweeper/SOURCE.json for provenance, the local +vendor/linesweeper with its upstream license files and one local patch. Its manifest names Joe Neeman +as author, and its LICENSE-MIT reads "Copyright (c) 2018 Raph Levien". See +vendor/linesweeper/README.craft.md and vendor/linesweeper/SOURCE.json for provenance, the local change and the files left out. Platform lifecycle source provenance diff --git a/vendor/linesweeper/README.craft.md b/vendor/linesweeper/README.craft.md index c9114be67d..47fe7a566d 100644 --- a/vendor/linesweeper/README.craft.md +++ b/vendor/linesweeper/README.craft.md @@ -193,6 +193,10 @@ local patches listed below. `.cargo_vcs_info.json` names the commit it was packa `824b0791a750f7b27b8edcbb6c6244d0e629875e`. That commit is not in the GitHub repository the manifest names, which is archived; its README says development moved off GitHub. +local patches listed below. `.cargo_vcs_info.json` names the commit it was packaged from, +`824b0791a750f7b27b8edcbb6c6244d0e629875e`. That commit is not in the GitHub repository the manifest +names, which is archived; its README says development moved off GitHub. + Every file here except this one, `SOURCE.json` and the patched files below is byte for byte the file in the `.crate` archive. `SOURCE.json` records the hash of the `.crate` download (`source_archive_sha256`) and, for every file kept, the hash in the package (`source_sha256`) and the @@ -243,6 +247,7 @@ Every change here updates this table and `SOURCE.json` in the same commit. | `CurveOrder` records `Metrics` entries only with the new `metrics` feature, which is off by default; without it `metrics.entries` stays empty. The `curve_metrics` example requires the feature | `Craft patch (metrics opt-in)` | `src/curve/mod.rs`, `Cargo.toml` | `curve::test::crossing_cubics_metrics_follow_the_feature`, `curve::test::crossing_cubics_order_does_not_depend_on_metrics`, `curve::test::crossing_cubics_metrics_record_the_recursion_depth`, `curve::test::curve_order_no_overlap` | Every change here updates this table and `SOURCE.json` in the same commit. +| `src/topology.rs` | `is_disjoint_tags` no longer calls `dbg!`, which printed two lines to stderr for every output segment on every call, in release builds too. It loops over `segment_indices()` instead of every winding entry, so it skips the segments that merging coincident segments deleted. The `disjoint_skips_merged_segments` test covers the second change. | `omitted_files` lists the 43 files of the package left out here, with their hashes: diff --git a/vendor/linesweeper/SOURCE.json b/vendor/linesweeper/SOURCE.json index b60217a28b..9b5b7f26bc 100644 --- a/vendor/linesweeper/SOURCE.json +++ b/vendor/linesweeper/SOURCE.json @@ -51,6 +51,7 @@ "In `src/curve/mod.rs`, `intersect_cubics_with_precomputed_decomp` calls the new `order_from_precomputed_approx` for each pair of pieces before `intersect_cubics_rec`. It compares the pieces' precomputed quadratic approximations over their shared y-range, with `ish_tolerance` as both tolerances, and when the result is a single `Left` or `Right` interval it records that order and skips `intersect_cubics_rec`, which would first cut both cubics with `y_subsegment`. Intervals shorter than `ish_tolerance` are left to `intersect_cubics_rec`. For `binary_op` on the stroke outline of 20,000 zigzag cubics (200,034 elements), 804,727 of 1,165,896 piece comparisons are decided this way, calls that cut cubics fall from 1,427,218 to 622,491, the median time falls from 2225.9 ms to 2109.1 ms, and the output is bit-identical. `curve::test::approximation_first_keeps_the_curve_order` compares the `CurveOrder` with and without the change for hand-built and generated pairs." "In `src/curve/mod.rs`, `intersect_cubics_rec` replaces the end x values in the precomputed approximations' `almost_horiz` with the end x values of the curves cut to the compared y-range, as `QuadraticApprox::from_cubic` sets them. The precomputed values belong to the whole almost-horizontal piece, so over a shorter y-range they bounded the wrong ends: for `c0 = (311.848,248.7972) (313.515,248.9023) (315.181,248.9698) (316.848,248.9988)` and `c1 = (316.909,243.813) (316.818,245.48) (316.698,247.146) (316.549,248.813)`, `intersect_cubics(c0, c1, 5e-7, 1e-6)` returned Left up to y = 248.8129995 and Ish up to 248.813, although the curves are 4.4457 apart there, and the sweep split `c0` at y = 248.813. `curve::test::almost_horizontal_piece_cut_to_the_overlap` covers the pair." "In `src/curve/mod.rs`, `CurveOrder::push` adds a `MetricsEntry` only when the new `metrics` feature is on. Before, it added one for every interval of every curve comparison, and `CurveOrder::flip` cloned them all, while only `examples/curve_metrics.rs` reads them. `Cargo.toml` adds the `metrics` feature, off by default, and gives the `curve_metrics` example `required-features = [\"metrics\"]`. The public `Metrics` types stay; without the feature `metrics.entries` is empty. For 150 horizontal and 150 vertical wavy cubics, each stroked 1.5 pt, `Topology::from_path` plus `contours` went from 877.1 ms to 806.8 ms (median of 7), from 1,946,341 to 1,378,442 allocations and from 163.0 MB to 117.9 MB peak heap, with the same contours. `curve::test::crossing_cubics_metrics_follow_the_feature` covers the recording and `curve::test::crossing_cubics_order_does_not_depend_on_metrics` covers the order, with and without the feature. With the feature, `curve::test::crossing_cubics_metrics_record_the_recursion_depth` checks the depth each interval records, and `curve::test::curve_order_no_overlap` checks the single entry of a comparison at one y." + "In `src/topology.rs`, `is_disjoint_tags` no longer prints its per-segment `dbg!` output to stderr, and it visits only the output segments that `segment_indices()` lists, skipping those deleted when coincident segments were merged." ], "files": [ { "path": ".cargo_vcs_info.json", "source_sha256": "47fba6a9dbdf445a5c97f783c9be62093035f9d5e5cdc2cf3216ad8259bcd8fc", "source_git_blob": null, "sha256": "47fba6a9dbdf445a5c97f783c9be62093035f9d5e5cdc2cf3216ad8259bcd8fc" }, @@ -157,6 +158,8 @@ { "path": "src/topology.rs", "source_sha256": "9c9b48bc3853884425127e2d64e8ed957ba0d27e1696e2c457e95282e52d6a5b", "source_git_blob": null, "sha256": "e5d112d5716e6735f654e6d57146b4ab345b5fce82a7ad9581a3a9c1e091beab" }, { "path": "src/sweep/sweep_line.rs", "source_sha256": "822b261f682911ea0c0370eaf17d9201a1e639b315359dcb6a3b877a229816e3", "source_git_blob": null, "sha256": "822b261f682911ea0c0370eaf17d9201a1e639b315359dcb6a3b877a229816e3" }, { "path": "src/topology.rs", "source_sha256": "9c9b48bc3853884425127e2d64e8ed957ba0d27e1696e2c457e95282e52d6a5b", "source_git_blob": null, "sha256": "d9ea8dcaf1112e876304d9342e04447382a5f210fbf2f607c826e493df7d5652" }, + { "path": "src/sweep/sweep_line.rs", "source_sha256": "822b261f682911ea0c0370eaf17d9201a1e639b315359dcb6a3b877a229816e3", "source_git_blob": null, "sha256": "822b261f682911ea0c0370eaf17d9201a1e639b315359dcb6a3b877a229816e3" }, + { "path": "src/topology.rs", "source_sha256": "9c9b48bc3853884425127e2d64e8ed957ba0d27e1696e2c457e95282e52d6a5b", "source_git_blob": null, "sha256": "b87fb6cc7c517d467760112d9fd237e3ab9581a0895b0602e7daafbe11039532" }, { "path": "src/treevec.rs", "source_sha256": "d88b9fbf02fa9f318560e1d483d465555f2b696ae12c00f8e4f5b71ea6779445", "source_git_blob": null, "sha256": "d88b9fbf02fa9f318560e1d483d465555f2b696ae12c00f8e4f5b71ea6779445" }, { "path": "src/sweep/sweep_line.rs", "source_sha256": "822b261f682911ea0c0370eaf17d9201a1e639b315359dcb6a3b877a229816e3", "source_git_blob": null, "sha256": "5dfbff54f25438ddb800f4136af5c7ef1d6d2a3a626ea5311dacefd884c5c9e8" }, { "path": "src/topology.rs", "source_sha256": "9c9b48bc3853884425127e2d64e8ed957ba0d27e1696e2c457e95282e52d6a5b", "source_git_blob": null, "sha256": "9c9b48bc3853884425127e2d64e8ed957ba0d27e1696e2c457e95282e52d6a5b" }, diff --git a/vendor/linesweeper/src/topology.rs b/vendor/linesweeper/src/topology.rs index f21b33083a..2974e24db6 100644 --- a/vendor/linesweeper/src/topology.rs +++ b/vendor/linesweeper/src/topology.rs @@ -1079,12 +1079,11 @@ impl Topology { inside1: impl Fn(&W) -> bool, inside2: impl Fn(&W) -> bool, ) -> bool { - self.winding.indices().all(|out_idx| { + self.segment_indices().all(|out_idx| { let w = &self.winding[out_idx]; let touches1 = inside1(&w.clockwise) || inside1(&w.counter_clockwise); let touches2 = inside2(&w.clockwise) || inside2(&w.counter_clockwise); - dbg!(touches1, touches2); !(touches1 && touches2) }) } @@ -2842,6 +2841,31 @@ mod tests { assert!(Topology::from_polylines_binary(s1, s2, 1e-5).is_disjoint(FillRule::EvenOdd)); } + #[test] + fn disjoint_skips_merged_segments() { + // The second set draws the same square twice, so its coincident edges are merged + // and the duplicates are deleted. + let s1 = [[p(0.0, 0.0), p(1.0, 0.0), p(1.0, 1.0), p(0.0, 1.0)]]; + let s2 = [ + [p(2.0, 0.0), p(3.0, 0.0), p(3.0, 1.0), p(2.0, 1.0)], + [p(2.0, 0.0), p(3.0, 0.0), p(3.0, 1.0), p(2.0, 1.0)], + ]; + let top = Topology::from_polylines_binary(s1, s2, 1e-5); + assert!(top.is_disjoint(FillRule::NonZero)); + + // With `inside1` always false, it is called for both sides of every segment visited. + let calls = std::cell::Cell::new(0); + let disjoint = top.is_disjoint_tags( + |_| { + calls.set(calls.get() + 1); + false + }, + |w| FillRule::NonZero.is_inside(w.shape_b), + ); + assert!(disjoint); + assert_eq!(calls.get(), 2 * top.segment_indices().count()); + } + #[test] fn normal_contours() { let s = [[p(0.0, 0.0), p(1.0, 0.0), p(1.0, 1.0), p(0.0, 1.0)]];