1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
//! Test-only differential oracle: a SECOND, independent ear-clipper.
//!
//! Both libraries give valid triangulations with the same boundary and area; only
//! the interior diagonals differ, and nothing downstream may depend on that
//! choice. `tests/triangulation_invariance.rs` measures whether anything does.
//!
//! Substituted at `safe_earcut`'s OWN `earcutr` call sites, never ahead of them, so
//! both triangulators receive the identical sanitised rings. Swapping earlier would
//! hand the oracle raw input and make the sweep partly measure `safe_earcut`'s
//! duplicate-stripping and hole classification rather than diagonal choice.
//!
//! Selection is an `AtomicBool`, not an env var: the library reads it per face on a
//! rayon-parallel hot path, and `std::env::set_var` is neither thread-safe nor safe
//! under edition 2024. The env var is honoured once, as an initialiser only.
use ;
use Once;
static ALT: AtomicBool = new;
static INIT: Once = new;
/// Turn the oracle on or off for this process. Test-side driver.
/// `Some(indices)` when the oracle is armed, `None` to use the production path.
/// Signature mirrors `earcutr::earcut(data, hole_indices, 2)`.
pub