mirror of
https://github.com/storytold/craft-libs.git
synced 2026-12-01 02:36:54 +01:00
Merge #645 (fix/linesweeper-segment-lower-horizontal) into integration/linesweeper
This commit is contained in:
commit
f75fced4df
3 files changed
+28
-1
No files matched your search
Vendored
+8
@@ -54,6 +54,9 @@ names, which is archived; its README says development moved off GitHub.
|
||||
`824b0791a750f7b27b8edcbb6c6244d0e629875e`. That commit is not in the GitHub repository the manifest
|
||||
names, which is archived; its README says development moved off GitHub.
|
||||
|
||||
`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 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
|
||||
@@ -76,6 +79,11 @@ and, for every file kept, the hash in the package (`source_sha256`) and the hash
|
||||
| `compute_positions` starts each output segment's `last_y` at the segment's start height instead of 0, so a segment that starts at `y < 0` is not skipped at its first queue entry and close segments there are put in order | `Craft patch (start height)` | `src/position.rs` | `position::tests::correct_positions_at_negative_y` |
|
||||
|
||||
Every change here updates this table and `SOURCE.json` in the same commit.
|
||||
| `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:
|
||||
|
||||
|
||||
Vendored
+2
-1
@@ -19,6 +19,7 @@
|
||||
"Remove the `boolean_op` and `winding-numbers` examples, the `fonts` and `snapshots` tests and the `linebender_logo` bench from `Cargo.toml`, since they need dev-dependencies or files the package leaves out. Their source files stay unchanged."
|
||||
"`ComparisonCache::compare_segments` in `src/order.rs` panics with the message \"compare_segments does not take horizontal segments\" when either segment is horizontal, in every build profile, and its doc comment states it. Before, a horizontal line and a cubic stopped at a `debug_assert` in `Segments::horiz_decomp` in a debug build, and a release build skipped that check."
|
||||
"In `src/position.rs`, `compute_positions` sets each output segment's `last_y` to the segment's start height before queuing it. It started at 0, so a segment starting at `y < 0` was skipped at its first queue entry and close segments there were not put in order: with `Correctness::ReallyCorrect`, two lenses 0.001 apart at `dy = 100` gave 48 corrected quadratics, and the same lenses at `dy = -100` gave 20 uncorrected cubics. `position::tests::correct_positions_at_negative_y` checks both heights."
|
||||
"`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" },
|
||||
@@ -52,7 +53,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": "8d2393e43000543c4ac3d47c2615e16733106af78ac67708ebf6941a039b9cdc" },
|
||||
|
||||
Vendored
+18
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user