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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
// 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/.
//! Shared N-ary arrangement and an explicit coordinate-preserving candidate.
use ;
use crateClippingProcessor;
use crate;
use cratedirected_closed;
use crateMesh;
/// Retain the existing mutually reconciled N-ary union. Cutter consumers
/// validate this result before deciding whether another candidate is needed.
/// Omit cross-operand promotion, preserving the supplied coordinates apart
/// from the kernel's existing snap and f32 emission. Used only by consumers
/// that validate the union through their actual subtraction (#3925).
pub
/// #3917: only a 3-operand union has a measured order-dependence (the
/// #3916-committed 882-configuration sweep is 7x7 corners x 3 `dz` x 6
/// orderings of exactly 3 operands; #3917's traced mechanism is specific to
/// `promote_operands_mutually` welding a THIRD operand against two already
/// reconciled with each other). Retrying every ordering is only attempted at
/// this exact N, so a 2- or 4+-operand union is completely unaffected by this
/// function existing.
const REORDER_SEARCH_OPERAND_COUNT: usize = 3;
/// #3917: cap the retry search to operand sets this small (total triangles
/// across all 3 operands), so a large real N-ary cutter union never pays for
/// up to 5 extra `arrange` attempts. `1_536` is generously above the 12
/// triangles-per-box, 36-triangle-total pinned #3913/#3917 fixture this
/// mechanism targets (simple box/prism cutters), while still bounding the
/// worst case: a large union already costs more than this search is worth,
/// and #3917's own measurements never exercised operands anywhere near this
/// size.
const MAX_REORDER_SEARCH_TRIS: usize = 1_536;
/// All 6 permutations of 3 array POSITIONS, applied to whatever order the
/// caller supplied. Because permuting a caller's own 3-element array through
/// every bijection of its OWN positions reaches every arrangement of the 3
/// physical operands regardless of what the caller's original order was
/// (permutation composition over a fixed 3-element set is the same group
/// whichever element you start from), this set is the caller-order-agnostic
/// version of `kernel::issue_3913_sweep_tests::ORDERINGS` — same 6 orderings,
/// expressed relative to the input array rather than to a fixed physical
/// labelling.
const REORDER_POSITIONS: = ;
/// #3917: whether `mesh`, taken through the SAME `consolidate_coplanar` pass
/// every real `union_many` caller already applies (`mesh_bridge_tests`'s own
/// module doc names `consolidate_coplanar(union_many(..))` as the standing
/// combination; `coaxial_union3d.rs` and `coaxial_union.rs` both call it
/// immediately after `union_many`), comes back closed.
///
/// This is NOT redundant with checking `mesh` itself: #3914's investigation
/// on this exact code path measured a raw `union_many` output that was
/// already closed (0 unmatched edges) and had `consolidate_coplanar`
/// introduce the tear — plane-bucket boundary straddle, a different
/// mechanism to this issue's, but the SAME lesson: whether a candidate
/// ordering is actually good is only decidable after the same
/// post-processing a real caller runs, not on the raw kernel output alone.
///
/// SCALE (#4744): this runs `consolidate_coplanar` at the metre default, while a
/// FILE-UNIT caller (`processors/boolean`) consolidates at the model's length
/// unit, so on a millimetre file the ring-noise width gate is inert here and
/// live there. The disagreement can only pick a worse ORDERING — production
/// still consolidates at the caller's scale, and its accept gates still run — so
/// it is recorded rather than fixed in the PR that made the gate physical.