mirror of
https://github.com/storytold/craft-libs.git
synced 2026-12-01 02:36:54 +01:00
Merge #686 (fix/linesweeper-public-fn-preconditions) into integration/linesweeper
This commit is contained in:
commit
85a2ae63cd
5 files changed
+160
-7
No files matched your search
@@ -289,6 +289,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
|
||||
|
||||
Vendored
+6
@@ -201,6 +201,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
|
||||
@@ -253,6 +257,8 @@ Every change here updates this table and `SOURCE.json` in the same commit.
|
||||
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. |
|
||||
| `src/treevec.rs` | The iterators that `iter`, `iter_mut`, `range` and `range_mut` return on a tree with more than one level keep their stack of child iterators in a `Stack`, which holds 8 levels in place and puts any deeper level in a `Vec`. Before, the stack was a `Vec` and each of these calls allocated once. The sweep line calls `range_mut` on a `TreeVec<_, 128>`, which 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. |
|
||||
| `src/curve/mod.rs` | `intersect_cubics` compares a curve whose `p3.y` is below its `p0.y` as the same curve reversed, instead of panicking in `clamp`. `intersect_cubics_with_precomputed_decomp` returns close (`Ish`) over the common range when `sure_tolerance` is not positive, is larger than `ish_tolerance`, or `ish_tolerance` is not finite, instead of panicking, overflowing the stack or returning a wrong order; when the curves' vertical ranges do not overlap, it returns an empty order without a debug assertion failure, and `CurveOrder::with_y_slop`, `CurveOrder::order_after` and `CurveOrder::check_invariants` accept that empty order instead of panicking on an `unwrap`. The docs of these functions, `from_monotone_cubic`, `solve_t_for_y` and `y_subsegment` state their input rules. The `curves_decreasing_in_y`, `invalid_tolerances` and `disjoint_vertical_ranges` tests cover the changes. |
|
||||
| `src/topology.rs` | `Topology::bounding_box` returns `Rect::ZERO` for a topology with no segments, as kurbo does for an empty path, instead of a rectangle from infinity to negative infinity. The `empty_bounding_box` test covers it. |
|
||||
|
||||
`omitted_files` lists the 43 files of the package left out here, with their hashes:
|
||||
|
||||
|
||||
Vendored
+4
@@ -53,6 +53,7 @@
|
||||
"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."
|
||||
"In `src/treevec.rs`, the tree iterators keep their stack of child iterators in a `Stack` that holds 8 levels in place and any deeper level in a `Vec`, so `iter`, `iter_mut`, `range` and `range_mut` no longer allocate on trees of up to 8 levels. The iterators visit the same elements in the same order."
|
||||
"In `src/curve/mod.rs`, `intersect_cubics` reverses a curve whose `p3.y` is below its `p0.y` before comparing it, and `intersect_cubics_with_precomputed_decomp` returns `Ish` over the common range when `sure_tolerance` is not positive or is larger than `ish_tolerance`, or `ish_tolerance` is not finite, and an empty order for curves whose vertical ranges do not overlap, which `CurveOrder::with_y_slop`, `CurveOrder::order_after` and `CurveOrder::check_invariants` accept; the docs of these functions, `from_monotone_cubic`, `solve_t_for_y` and `y_subsegment` state their input rules. In `src/topology.rs`, `Topology::bounding_box` returns `Rect::ZERO` when there are no segments."
|
||||
],
|
||||
"files": [
|
||||
{ "path": ".cargo_vcs_info.json", "source_sha256": "47fba6a9dbdf445a5c97f783c9be62093035f9d5e5cdc2cf3216ad8259bcd8fc", "source_git_blob": null, "sha256": "47fba6a9dbdf445a5c97f783c9be62093035f9d5e5cdc2cf3216ad8259bcd8fc" },
|
||||
@@ -98,6 +99,7 @@
|
||||
{ "path": "src/curve/mod.rs", "source_sha256": "36a8dbe96ac1d3bec307dc63b504206ec7fdfc11d10799fbb1a8990c29b8c5f2", "source_git_blob": null, "sha256": "fa663221bb7202f10d5bc2ed45f07c8d8a16aa9ec0ecd263e08d3f3b77319661" },
|
||||
{ "path": "src/curve/mod.rs", "source_sha256": "36a8dbe96ac1d3bec307dc63b504206ec7fdfc11d10799fbb1a8990c29b8c5f2", "source_git_blob": null, "sha256": "d11ac08cfb54ea794e3d62b1da1a3235b668e9f46d72fb807c3ab1eff3b722b8" },
|
||||
{ "path": "src/curve/mod.rs", "source_sha256": "36a8dbe96ac1d3bec307dc63b504206ec7fdfc11d10799fbb1a8990c29b8c5f2", "source_git_blob": null, "sha256": "6ea1c1387ae1a3a39c9ce3a4bf6b5bf566b5d5193850285db60b143e01d26319" },
|
||||
{ "path": "src/curve/mod.rs", "source_sha256": "36a8dbe96ac1d3bec307dc63b504206ec7fdfc11d10799fbb1a8990c29b8c5f2", "source_git_blob": null, "sha256": "ad8eee65561fdfd32892348a0710717bca54e736a364ddd3587f09694cb69c10" },
|
||||
{ "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" },
|
||||
@@ -161,6 +163,8 @@
|
||||
{ "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/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": "9ce5c474a4fa9a30fcffe21f0fa4878ee39d3149dfe48b57f7000e396844187e" },
|
||||
{ "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" },
|
||||
|
||||
Vendored
+134
-7
@@ -282,8 +282,11 @@ impl CurveOrder {
|
||||
|
||||
let mut ret = SmallVec::<[CurveOrderEntry; 3]>::new();
|
||||
|
||||
// unwrap: cmps is always non-empty
|
||||
let last_end = self.cmps.last().unwrap().end;
|
||||
// Craft patch (input rules): curves with disjoint vertical ranges have
|
||||
// an empty order.
|
||||
let Some(last_end) = self.cmps.last().map(|e| e.end) else {
|
||||
return self;
|
||||
};
|
||||
|
||||
if self.start == last_end || self.cmps.len() <= 1 {
|
||||
return self;
|
||||
@@ -340,7 +343,9 @@ impl CurveOrder {
|
||||
/// Asserts that we satisfy our internal invariants. For testing only.
|
||||
pub fn check_invariants(&self) {
|
||||
let mut cmps = self.cmps.iter();
|
||||
let mut last = cmps.next().unwrap();
|
||||
let Some(mut last) = cmps.next() else {
|
||||
return;
|
||||
};
|
||||
for cmp in cmps {
|
||||
assert!(last.end <= cmp.end);
|
||||
assert!(last.order != cmp.order);
|
||||
@@ -384,8 +389,13 @@ impl CurveOrder {
|
||||
/// As a corner case, if this comparison ends exactly at `y` then we return
|
||||
/// the ordering exactly at `y`.
|
||||
pub fn order_after(&self, y: f64) -> Order {
|
||||
if y == self.cmps.last().unwrap().end {
|
||||
self.cmps.last().unwrap().order
|
||||
// Craft patch (input rules): curves with disjoint vertical ranges have
|
||||
// an empty order.
|
||||
let Some(last) = self.cmps.last() else {
|
||||
return Order::Ish;
|
||||
};
|
||||
if y == last.end {
|
||||
last.order
|
||||
} else {
|
||||
self.iter()
|
||||
.skip_while(|(_start, end, _order)| end <= &y)
|
||||
@@ -396,6 +406,17 @@ impl CurveOrder {
|
||||
}
|
||||
|
||||
/// Find the parameter `t` at which `c` crosses height `y`.
|
||||
///
|
||||
/// `c` must be y-monotone with `c.p0.y < c.p3.y`, and `y` must be in
|
||||
/// `c.p0.y..=c.p3.y`. For other inputs, release builds return a parameter in
|
||||
/// `0.0..=1.0` that need not be a crossing.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Debug builds panic unless `c.p0.y <= y && y <= c.p3.y && c.p0.y < c.p3.y`.
|
||||
/// They do not check whether `c` is y-monotone. For a curve that is not, they
|
||||
/// return one of its crossings, or a parameter that is not a crossing, without
|
||||
/// a panic.
|
||||
pub fn solve_t_for_y(c: CubicBez, y: f64) -> f64 {
|
||||
debug_assert!(
|
||||
c.p0.y <= y && y <= c.p3.y && c.p0.y < c.p3.y,
|
||||
@@ -445,6 +466,15 @@ pub fn solve_x_for_y(c: CubicBez, y: f64) -> f64 {
|
||||
///
|
||||
/// The input curve should be monotonic in `y`, and its range should include
|
||||
/// `y0` and `y1` (which should be ordered).
|
||||
///
|
||||
/// For other inputs, release builds return a curve that starts at height `y0`
|
||||
/// and ends at height `y1`, but whose ends need not lie on `c`. With `y0 > y1`
|
||||
/// it runs from `y0` down to `y1`.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Debug builds panic when `y0` is not less than `y1` or when `c` does not
|
||||
/// cover `y0..=y1`. They do not check whether `c` is y-monotone.
|
||||
pub fn y_subsegment(c: CubicBez, y0: f64, y1: f64) -> CubicBez {
|
||||
debug_assert!(y0 < y1);
|
||||
debug_assert!(c.p0.y <= y0 && y1 <= c.p3.y);
|
||||
@@ -1450,6 +1480,10 @@ impl AlmostHorizontalDecomposition {
|
||||
/// Decompose a cubic into almost-horizontal and not-almost-horizontal pieces.
|
||||
///
|
||||
/// The cubic `c` must be (approximately) y-monotone and must not be completely horizontal.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `c` is completely horizontal or if `c.p3.y` is smaller than `c.p0.y`.
|
||||
pub fn from_monotone_cubic(c: CubicBez) -> Self {
|
||||
const THRESHOLD: f64 = 16.0;
|
||||
let dx = cubic_from_bez_x(c).deriv();
|
||||
@@ -1596,12 +1630,27 @@ impl AlmostHorizontalDecomposition {
|
||||
/// The `ish_tolerance` parameter tells us when we're allowed to say that
|
||||
/// the two curves are close: if they're definitely within `ish_tolerance`
|
||||
/// of one another, we can say that they're close.
|
||||
///
|
||||
/// `sure_tolerance` must be positive and no larger than `ish_tolerance`, and
|
||||
/// `ish_tolerance` must be finite. Otherwise the returned order says that the
|
||||
/// curves are close over their whole common range.
|
||||
///
|
||||
/// Each curve must be y-monotone. A curve whose `p3.y` is smaller than its
|
||||
/// `p0.y` is compared as the same curve with its control points reversed.
|
||||
/// When the vertical ranges of the curves do not overlap, the returned order
|
||||
/// has no entries.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if either curve is completely horizontal.
|
||||
pub fn intersect_cubics(
|
||||
c0: CubicBez,
|
||||
c1: CubicBez,
|
||||
sure_tolerance: f64,
|
||||
ish_tolerance: f64,
|
||||
) -> CurveOrder {
|
||||
let c0 = increasing_in_y(c0);
|
||||
let c1 = increasing_in_y(c1);
|
||||
intersect_cubics_with_precomputed_decomp(
|
||||
c0,
|
||||
&AlmostHorizontalDecomposition::from_monotone_cubic(c0),
|
||||
@@ -1612,11 +1661,26 @@ pub fn intersect_cubics(
|
||||
)
|
||||
}
|
||||
|
||||
// Craft patch (input rules): `intersect_cubics` compares a curve that runs
|
||||
// down in y as the same curve reversed.
|
||||
/// Returns `c`, or `c` with its control points reversed if it decreases in y.
|
||||
fn increasing_in_y(c: CubicBez) -> CubicBez {
|
||||
if c.p3.y < c.p0.y {
|
||||
CubicBez::new(c.p3, c.p2, c.p1, c.p0)
|
||||
} else {
|
||||
c
|
||||
}
|
||||
}
|
||||
|
||||
/// A version of [intersect_cubics] that uses a precomputed almost-horizontal
|
||||
/// decomposition.
|
||||
///
|
||||
/// Pre-computing the almost-horizontal decomposition can be much faster, because
|
||||
/// then you can do it per-curve instead of per-comparison.
|
||||
///
|
||||
/// `c0_div` and `c1_div` must be the decompositions of `c0` and `c1`, so each
|
||||
/// curve must have `p0.y < p3.y`. The tolerances follow the same rule as in
|
||||
/// [intersect_cubics].
|
||||
pub fn intersect_cubics_with_precomputed_decomp(
|
||||
c0: CubicBez,
|
||||
c0_div: &AlmostHorizontalDecomposition,
|
||||
@@ -1675,7 +1739,15 @@ fn intersect_decompositions(
|
||||
let y1 = c0.p3.y.min(c1.p3.y);
|
||||
|
||||
let mut ret = CurveOrder::new(y0);
|
||||
if y0 < y1 {
|
||||
let valid_tolerances =
|
||||
sure_tolerance > 0.0 && sure_tolerance <= ish_tolerance && ish_tolerance.is_finite();
|
||||
if !valid_tolerances {
|
||||
// Craft patch (input rules): with a negative `ish_tolerance`,
|
||||
// `intersect_cubics_rec` can recurse without end.
|
||||
if y0 <= y1 {
|
||||
ret.push(y1, Order::Ish, MetricsStatus::default());
|
||||
}
|
||||
} else if y0 < y1 {
|
||||
let c0_div = c0_div
|
||||
.pieces
|
||||
.iter()
|
||||
@@ -1733,7 +1805,7 @@ fn intersect_decompositions(
|
||||
ret.push(y1, order, MetricsStatus::default());
|
||||
}
|
||||
//fix_up_endpoints(&mut ret, c0, c1, eps);
|
||||
debug_assert_eq!(ret.cmps.last().unwrap().end, y1);
|
||||
debug_assert!(y0 > y1 || ret.cmps.last().map(|e| e.end) == Some(y1));
|
||||
ret
|
||||
}
|
||||
|
||||
@@ -2028,6 +2100,61 @@ mod test {
|
||||
dbg!(intersect_cubics(c0, c1, 0.5e-6, 1.5e-6));
|
||||
}
|
||||
|
||||
// Craft patch (input rules) tests: curves that run down in y, tolerances
|
||||
// outside the documented rule, and curves with no common y-range.
|
||||
fn vertical(x: f64, y0: f64, y1: f64) -> CubicBez {
|
||||
PathSeg::Line(Line::new((x, y0), (x, y1))).to_cubic()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn curves_decreasing_in_y() {
|
||||
let up0 = vertical(0.0, 0.0, 1.0);
|
||||
let up1 = vertical(1.0, 0.0, 1.0);
|
||||
let down0 = vertical(0.0, 1.0, 0.0);
|
||||
let down1 = vertical(1.0, 1.0, 0.0);
|
||||
for (c0, c1) in [(down0, down1), (down0, up1), (up0, down1)] {
|
||||
let cmp = intersect_cubics(c0, c1, 1e-6, 2e-6);
|
||||
assert_eq!(cmp.iter().collect::<Vec<_>>(), [(0.0, 1.0, Order::Left)]);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_tolerances() {
|
||||
let c0 = vertical(0.0, 0.0, 1.0);
|
||||
let parallel = vertical(1.0, 0.0, 1.0);
|
||||
let crossing = CubicBez::new(
|
||||
(1.0, 0.0),
|
||||
(2.0 / 3.0, 1.0 / 3.0),
|
||||
(1.0 / 3.0, 2.0 / 3.0),
|
||||
(0.0, 1.0),
|
||||
);
|
||||
let tolerances = [
|
||||
(-1.0, -1.0),
|
||||
(-1.0, 1e-6),
|
||||
(1e-6, -1.0),
|
||||
(-1e-9, -1e-9),
|
||||
(0.0, 0.0),
|
||||
(2e-6, 1e-6),
|
||||
(1e-6, f64::INFINITY),
|
||||
(f64::NAN, 1e-6),
|
||||
];
|
||||
for (sure, ish) in tolerances {
|
||||
for c1 in [c0, parallel, crossing] {
|
||||
let cmp = intersect_cubics(c0, c1, sure, ish);
|
||||
assert_eq!(cmp.iter().collect::<Vec<_>>(), [(0.0, 1.0, Order::Ish)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn disjoint_vertical_ranges() {
|
||||
let cmp = intersect_cubics(vertical(0.0, 0.0, 1.0), vertical(1.0, 2.0, 3.0), 1e-6, 2e-6);
|
||||
assert_eq!(cmp.iter().count(), 0);
|
||||
cmp.check_invariants();
|
||||
assert_eq!(cmp.order_after(0.5), Order::Ish);
|
||||
assert_eq!(cmp.with_y_slop(0.5).iter().count(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn y_slop_single_seg() {
|
||||
let order = CurveOrder {
|
||||
|
||||
Vendored
+13
@@ -1653,7 +1653,13 @@ impl<W: WindingNumber> Topology<W> {
|
||||
}
|
||||
|
||||
/// Returns a rectangle bounding all of our segments.
|
||||
///
|
||||
/// With no segments, it returns `Rect::ZERO`, as kurbo does for an empty path.
|
||||
pub fn bounding_box(&self) -> kurbo::Rect {
|
||||
// Craft patch (input rules): an empty topology has a zero rectangle.
|
||||
if self.segments.segments().next().is_none() {
|
||||
return Rect::ZERO;
|
||||
}
|
||||
let mut rect = Rect::new(
|
||||
f64::INFINITY,
|
||||
f64::INFINITY,
|
||||
@@ -2501,6 +2507,13 @@ mod tests {
|
||||
insta::assert_ron_snapshot!(top);
|
||||
}
|
||||
|
||||
// Craft patch (input rules) test.
|
||||
#[test]
|
||||
fn empty_bounding_box() {
|
||||
let top = Topology::from_polylines_binary(EMPTY, EMPTY, 0.01);
|
||||
assert_eq!(top.bounding_box(), kurbo::Rect::ZERO);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn diamond() {
|
||||
let segs = [[p(0.0, 0.0), p(1.0, 1.0), p(0.0, 2.0), p(-1.0, 1.0)]];
|
||||
|
||||
Reference in new issue
Block a user