Solution (source code)

= Solution

The tight <axis-aligned bounding box> is $Q=[0,2]\times[0,2]$. Bisect vertically at $x=1$, giving a right child $R=[1,2]\times[0,2]$. For a scalar <implicit function> representing the same <constructive solid geometry> solid, use
$$
\Phi=\max\{f_5,f_6,f_4,f_1,\min(f_2,f_3)\},\qquad P=\{\Phi\le0\}.
$$
With the convention $f_i\le0$ inside, <set intersection> corresponds to the <maximum>, and <set union> to the <minimum>. These operations encode membership; $\Phi$ is not a signed <distance function>.

Since every $f_i$ is an <affine function>, its extreme values on $R$ occur at corners. Exact real-arithmetic <interval arithmetic> gives:

|| Function
|| Range on $R$
| $f_1$
| $[-1-\sqrt3,\sqrt3]$
| $f_2$
| $[-1,1]$
| $f_3$
| $[0,1]$
| $f_4$
| $[-2,0]$
| $f_5$
| $[-2,-1]$
| $f_6$
| $[-2,0]$
| $\min(f_2,f_3)$, propagated
| $[-1,1]$
| $\Phi$, propagated
| $[-1,\sqrt3]$

Each leaf range is exact, but combining independent <intervals> forgets that the expressions share $x,y$. The final enclosure need not be the exact range of $\Phi$. For example, equality $\Phi=-1$ would require both $f_6\le-1$, hence $y\ge1$, and $\min(f_2,f_3)\le-1$, hence $y\le0$ on $R$, which is impossible. The enclosure is still sufficient for a reliable three-way decision:
$$
\boxed{\sup\Phi(R)<0:\ \text{inside};\quad
\inf\Phi(R)>0:\ \text{outside};\quad
0\in\Phi(R):\ \text{unresolved, so refine}.}
$$
Here the result is unresolved. This is a real mixed box, rather than only a pessimistic test: $(5/4,3/4)$ is strictly inside, whereas $(3/2,3/2)$ is outside. A zero endpoint alone can also mean contact with the boundary, so equality must not be treated as proof of strict interior or strict exterior. In <floating-point arithmetic>, certified bounds require <outward rounding>.

Continue splitting unresolved boxes, normally alternating axes or splitting the longest side. Propagate the <interval arithmetic> results through the <constructive solid geometry tree>, discard exterior boxes and stop refining strict interior boxes. In sufficiently small boundary boxes, locate crossings of the active <implicit equations> with box edges and connect them into boundary <line segments>. Retain corners and resolve ambiguous multiple crossings by further refinement; here every genuine boundary piece is straight, so its supporting <implicit equation> allows exact intersection rather than a curved approximation. A maximum boundary-box diagonal $\varepsilon$ gives spatial localization at that scale, provided no boundary components are discarded; corner-sign sampling alone provides no such guarantee.

The tight box saves empty-space work, but it is awkward for extracting <facets>. Entire boundary <line segments>, notably $EO$, $OA$ and $DE$, lie on the initial box boundary, and $CD$ lies on the first splitting <straight line>. A sign-change-only method may have no exterior sample on the other side and lose such pieces; exact zeros also persist through refinement. A slightly padded initial <axis-aligned bounding box>, together with an explicit rule for boundary-coincident pieces, makes the faceting more robust. The tight box is therefore economical for enclosure but not the best unqualified choice for a simple faceting implementation.