From 5c42ac9d1858b13b8005a63454afda7e5a306ddb Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 6 Nov 2026 23:13:00 -0800 Subject: [PATCH] linesweeper: Segment::lower bounds a horizontal line by its left end `local_bbox` took both x values of a line from `at_y`, which returns the right end of a horizontal line. For the line from (0, 0) to (10, 0), `lower(0.0, 0.25)` returned 9.75 instead of -0.25. A horizontal line is now bounded by both endpoints. The change is recorded in `SOURCE.json` and the Local changes table in `README.craft.md`. --- vendor/linesweeper/README.craft.md | 24 +++++++++++++++++------- vendor/linesweeper/SOURCE.json | 6 ++++-- vendor/linesweeper/src/geom.rs | 18 ++++++++++++++++++ 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/vendor/linesweeper/README.craft.md b/vendor/linesweeper/README.craft.md index f683ca53de..6cf813a7ef 100644 --- a/vendor/linesweeper/README.craft.md +++ b/vendor/linesweeper/README.craft.md @@ -1,15 +1,25 @@ # Local linesweeper 0.5.0 copy -This is the crates.io linesweeper 0.5.0 package (MIT OR Apache-2.0) with some files left out and no -file changed. `.cargo_vcs_info.json` names the commit it was packaged from, +This is the crates.io linesweeper 0.5.0 package (MIT OR Apache-2.0) with some files left out and the +changes listed under Local changes. `.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 and `SOURCE.json` 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 hash here (`sha256`). `upstream_repository` is -null because no public repository this copy can name holds `upstream_revision`. `local_patches` is -empty. +Every file here except this one, `SOURCE.json` and the files under Local changes 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 +hash here (`sha256`). `upstream_repository` is null because no public repository this copy can name +holds `upstream_revision`. `local_patches` describes each local change. + +## Local changes + +| Change | Code comment label | Touches | Tests | +|---|---|---|---| +| `Segment::lower` and `Segment::upper` bound a horizontal line by both of its endpoints | `Craft patch (horizontal line bounds)` | `src/geom.rs` | `horizontal_line_bounds_cover_both_endpoints` | + +Every change here updates this table and `SOURCE.json` in the same commit. To take a new linesweeper +release, unpack the crates.io package, carry these changes over, regenerate `SOURCE.json`, and run the +tests below. `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 9c71e51add..f3bd4e4626 100644 --- a/vendor/linesweeper/SOURCE.json +++ b/vendor/linesweeper/SOURCE.json @@ -7,7 +7,9 @@ "upstream_repository": null, "upstream_revision": "824b0791a750f7b27b8edcbb6c6244d0e629875e", "upstream_directory": "", - "local_patches": [], + "local_patches": [ + "`Segment::lower` and `Segment::upper` bound a horizontal line by both of its endpoints. In the package, `local_bbox` takes both x values from `at_y`, which returns the right end of a horizontal line, and `lower` returns the right end minus `eps`." + ], "files": [ { "path": ".cargo_vcs_info.json", "source_sha256": "47fba6a9dbdf445a5c97f783c9be62093035f9d5e5cdc2cf3216ad8259bcd8fc", "source_git_blob": null, "sha256": "47fba6a9dbdf445a5c97f783c9be62093035f9d5e5cdc2cf3216ad8259bcd8fc" }, { "path": ".gitignore", "source_sha256": "88b59092499ae05234330eb7d0b01e953e969caf05261530e3765eef02536cf0", "source_git_blob": null, "sha256": "88b59092499ae05234330eb7d0b01e953e969caf05261530e3765eef02536cf0" }, @@ -36,7 +38,7 @@ { "path": "src/curve/split_quad.rs", "source_sha256": "b8aae4ce7c16fa623724f667e1058130a9c7eed693b5b01e8b9e16632b8ec45f", "source_git_blob": null, "sha256": "b8aae4ce7c16fa623724f667e1058130a9c7eed693b5b01e8b9e16632b8ec45f" }, { "path": "src/curve/transverse.rs", "source_sha256": "be9c695531f4cb0fe73af13e78040b51b9476c193d84562e701aadd07b3fd06e", "source_git_blob": null, "sha256": "be9c695531f4cb0fe73af13e78040b51b9476c193d84562e701aadd07b3fd06e" }, { "path": "src/generators.rs", "source_sha256": "cc9f2441546db9204219294c354449809dda77dffad06fec8a30f45df01e6fef", "source_git_blob": null, "sha256": "cc9f2441546db9204219294c354449809dda77dffad06fec8a30f45df01e6fef" }, - { "path": "src/geom.rs", "source_sha256": "9878ffa6d4a13fa2c9149741c137205ca01acb626a5b9f86a3db75cf91b63a08", "source_git_blob": null, "sha256": "9878ffa6d4a13fa2c9149741c137205ca01acb626a5b9f86a3db75cf91b63a08" }, + { "path": "src/geom.rs", "source_sha256": "9878ffa6d4a13fa2c9149741c137205ca01acb626a5b9f86a3db75cf91b63a08", "source_git_blob": null, "sha256": "53199cf966d02002b8bfdfc03fd839903d98c852585c93529d45129d34865128" }, { "path": "src/lib.rs", "source_sha256": "761c153c3b5c449569ff85c571344b9252ea64f7f0b0424fb4819041b03d13c6", "source_git_blob": null, "sha256": "761c153c3b5c449569ff85c571344b9252ea64f7f0b0424fb4819041b03d13c6" }, { "path": "src/num.rs", "source_sha256": "39ff85da50c500ce91cf6dea81aedc0dcca1db5e7d0506696dde2da118e93a2a", "source_git_blob": null, "sha256": "39ff85da50c500ce91cf6dea81aedc0dcca1db5e7d0506696dde2da118e93a2a" }, { "path": "src/order.rs", "source_sha256": "7e5b04eae8af134abb032e995f1d3c2ac473822923dfee8d463d9ade6ffeb596", "source_git_blob": null, "sha256": "7e5b04eae8af134abb032e995f1d3c2ac473822923dfee8d463d9ade6ffeb596" }, diff --git a/vendor/linesweeper/src/geom.rs b/vendor/linesweeper/src/geom.rs index 6aa0bdabe4..f1d6b7ed07 100644 --- a/vendor/linesweeper/src/geom.rs +++ b/vendor/linesweeper/src/geom.rs @@ -492,6 +492,11 @@ impl Segment { let end_y = (y + eps).min(self.end().y); match self.inner { + // Craft patch (horizontal line bounds): a horizontal line is bounded by both + // endpoints. `at_y` returns only its right end. + SegmentInner::Line { p0, p1 } if self.is_horizontal() => { + kurbo::Rect::from_points((p0.x, p0.y), (p1.x, p1.y)) + } SegmentInner::Line { .. } => { let start_x = self.at_y(start_y); let end_x = self.at_y(end_y); @@ -540,3 +545,16 @@ impl Segment { } } } + +#[cfg(test)] +mod tests { + use super::*; + + // Craft patch (horizontal line bounds) + #[test] + fn horizontal_line_bounds_cover_both_endpoints() { + let s = Segment::straight(Point::new(0.0, 0.0), Point::new(10.0, 0.0)); + assert_eq!(s.lower(0.0, 0.25), -0.25); + assert_eq!(s.upper(0.0, 0.25), 10.25); + } +}