---
title: B-Rep Distance Functions (BR-DF)
url: https://www.emergentmind.com/topics/b-rep-distance-functions-br-df
type: topic
---

# B-Rep Distance Functions (BR-DF)

Boundary-Representation Distance Functions (BR-DF) constitute a unified framework for encoding, analyzing, and reconstructing geometric models from their boundary representations using distance-based volumetric and functional constructs. BR-DF plays a crucial role in CAD, shape optimization, level set methods, and generative modeling, providing both explicit geometric information and a basis for robust numerical algorithms [2511.14870][2211.02319][1602.03425].

## 1. Mathematical Preliminaries: Definitions and Core Properties

Let $U \subset \mathbb{R}^2$ (or, in the volumetric setting, $M \subset \mathbb{R}^3$) be a bounded domain with a boundary representation (B-Rep) specified via vertices, edges, and faces. The BR-DF framework generalizes the notion of distance-to-boundary using the gauge function $\gamma_K$ of a compact, convex set $K$ with $0$ in its interior. For any $x \in \overline{U}$, the $K$-distance to the boundary is defined as
$$
d_K(x) = \min_{y \in \partial U} \gamma_K(x - y)
$$
where
$$
\gamma_K(x) = \inf\{\lambda > 0 : x \in \lambda K\}
$$
and $\gamma_{K^\circ}$, the polar gauge, is given by
$$
\gamma_{K^\circ}(y) = \inf\{\mu > 0 : y \in \mu K^\circ\}, \quad K^\circ = \{y : \langle x, y \rangle \leq 1 \ \forall x \in K\}
$$
For standard Euclidean distances, $K$ is the unit disk.

The volumetric extension, crucial for 3D geometry and CAD, utilizes the signed distance function (SDF)
$$
\varphi(x) = \begin{cases}
-\min_{y \in \partial M} \|x - y\|, & x \in \text{interior}(M) \\
+\min_{y \in \partial M} \|x - y\|, & x \notin M
\end{cases}
$$
The set $\Sigma = \{x \in \Omega \mid \varphi(x) = 0\}$ forms a watertight surface encompassing the geometry [2511.14870].

For each B-Rep face $f_i$, a per-face unsigned distance function (UDF) is defined as
$$
u_i(x) = \min_{y \in f_i} \|x - y\|, \quad u_i : \Omega \to \mathbb{R}_{\geq 0}
$$
These fields capture both the geometry (SDF) and topology (via the collection of $\{u_i\}$) of a B-Rep model.

## 2. Regularity, Ridge Set, and Generalized Curvature

The regularity properties of $d_K$ depend strongly on the boundary geometry and the choice of norm. At points $x \in U$ with a unique closest boundary point $y \in \partial U$ and under sufficient smoothness of $\partial U$, the following hold:
- Gradient:
  $$
  \nabla d_K(x) = \frac{\nu}{\gamma_{K^\circ}(\nu)}, \quad \nu = \text{inward normal at } y
  $$
- Hessian (for $1 - \kappa_K(y) d_K(x) \neq 0$):
  $$
  D^2d_K(x) = \Delta d_K(x) (\zeta \otimes \zeta), \qquad
  \Delta d_K(x) = -\frac{\kappa(y) |\nu|^3 |D\gamma_{K^\circ}(\nu)|^2}{\gamma_{K^\circ}(\nu)^3 (1-\kappa_K(y) d_K(x))}
  $$
$\zeta$ is the unit vector orthogonal to $(x-y)$.

Singularities arise where the closest boundary point is non-unique or the denominator vanishes, i.e., $1-\kappa_K(y)d_K(x)=0$. The ridge set $R_K$ (a generalization of the medial axis) consists of all points where $d_K$ is not locally $C^{1,1}$:
$$
R_K = R_{K,0} \cup \{x \in U \setminus R_{K,0} : 1 - \kappa_K(y(x)) d_K(x) = 0\}
$$
with $R_{K,0}$ being loci with multiple closest boundary points [1602.03425]. The $K$-curvature $\kappa_K$ generalizes traditional curvature to arbitrary gauges.

## 3. BR-DF Representation and Topology Encoding

In modern applications, especially CAD geometry, BR-DF encodes not only surface geometry but also face, edge, and vertex structure:
- For a discrete 3D grid, one stores $\varphi$ (SDF) and all $u_i$ (per-face UDFs) [2511.14870].
- On the zero level set $\Sigma$, face indices are recovered as $i^*(x) = \arg\min_i u_i(x)$.
- Face regions, edges, and vertices are encoded via local co-minimality:
  - Face patch: $F_i = \{x \in \Sigma : u_i(x) \leq u_j(x), \forall j\}$
  - Edge: $E_{ij} = \{x \in \Sigma : u_i(x) = u_j(x) \leq u_k(x), \forall k\}$
  - Vertex: $V_{ijk} = \{x \in \Sigma : u_i(x) = u_j(x) = u_k(x) \leq u_\ell(x), \forall \ell\}$

This volumetric encoding enables implicit representation of topological adjacency, obviating explicit graph structures.

## 4. Algorithms for Computation and Reconstruction

For 2D polygonal B-Rep boundaries under arbitrary asymmetric norms:
- Each query $x$ computes $d_e = \gamma_K(x - y_e)$ for every edge projection $y_e$, and $d_v = \gamma_K(x - v)$ for vertices.
- The minimum distance $d_{\min}$ sets $d_K(x)$. If multiple minimizers exist, $x$ lies on the ridge.
- The gradient and Hessian are evaluated at non-ridge points as above.
- The algorithm identifies singularities via ridge conditions and provides pseudocode for efficient evaluation [1602.03425].

For 3D BR-DF models:
- The Marching Cubes and Triangles (MCT) algorithm extracts the surface mesh from sampled $\varphi$.
- Each mesh vertex is assigned a face label via minimal $u_i$.
- Edges and vertices are reconstructed by local intersection and co-minimality of UDFs, ensuring watertight, topologically consistent faceted B-Rep meshes.
- This process is strictly local per triangle, but guarantees global watertightness and combinatorial correctness [2511.14870].

## 5. Elliptic and Variational Methods for BR-DF Computation

Traditional fast-marching and sweeping schemes solve the Eikonal equation on structured domains. For general B-Rep (complex or unstructured), the elliptic approximation via the Hopf–Cole transform provides enhanced efficiency and robustness [2211.02319]:
- Given target Eikonal $|\nabla u|^2 - 1 = 0$ in $\Omega$ with Dirichlet BC on $\Gamma_D$,
- Introduce viscosity $\nu$ to obtain $|\nabla u|^2 - 1 = \nu \Delta u$,
- Via $u(x) = -\nu \log \varphi(x)$, the problem becomes linear: $\nu^2 \Delta \varphi = \varphi$ with $\varphi=1$ on $\Gamma_D$.
- Uzawa-type iterations update side boundaries using a discrete Godunov-type rule; convergence is ensured by a discrete maximum principle.
- Error estimates: $\|\varphi - \varphi^h\|_{L^\infty} \leq C h^2/\nu^2$, giving $\|u-u_h\|_{L^\infty} \leq C(h/\nu+\nu)$ for mesh size $h$.
- Empirical complexity $\mathcal{O}(h^{-1})$, significantly better than hyperbolic solvers on fine meshes [2211.02319].

The elliptic approach is particularly suitable for repeated BR-DF evaluations in turbulence modeling, image analysis, and design tasks requiring numerous distance queries.

## 6. Generative Modeling and Data-driven BR-DFs

The BR-DF representation underlies generative models for 3D B-Rep geometry:
- A two-stage latent diffusion framework jointly predicts the SDF and UDFs: first, bounding-box diffusion to estimate the number and extent of faces; second, 3D VQ-VAE encodings and a 3D U-Net latent diffusion model reconstruct the volumetric distance fields.
- Cross-attention in the U-Net enables conditioning the SDF (global shape) on facial UDFs and vice versa.
- The joint latent model is trained to minimize predicted noise on both surface and face-branch latents.
- Experimental outcomes show high coverage (COV≈73.7%), low Chamfer distance (≈6.6×10^{-4}) validating topological and geometric faithfulness, with 100% success in producing watertight faceted B-Rep models [2511.14870].

## 7. Applications and Implications

BR-DFs unify Euclidean, $p$-norm, and arbitrary Finsler-type distance computations, generalize medial skeletons to non-Euclidean settings, and provide explicit volumetric encoding of B-Rep geometry and topology:
- Offset surface computation in CAD
- Fast front-propagation and level set schemes
- Shape optimization, variational PDEs, and Monge–Kantorovich problems
- Curvature-driven flows and image processing
- Generative 3D model synthesis from latent spaces using distance-based fields

Robustness to geometric degeneracies, explicit gradient and Hessian formulas, and amenability to linear-algebraic acceleration render BR-DF a foundational tool in modern geometric computing [1602.03425][2211.02319][2511.14870].

| Domain           | Key BR-DF Role                | Notable Reference   |
|------------------|------------------------------|---------------------|
| CAD Modeling     | Geometry/topology encoding    | [2511.14870]        |
| PDE/Numerics     | Distance for front evolution  | [2211.02319]        |
| Medial Axis      | Ridge set analysis            | [1602.03425]        |

The BR-DF methodology is extensible to higher-dimensional and more abstract settings, suggesting continued relevance in shape analysis and computational design.

Source: https://www.emergentmind.com/topics/b-rep-distance-functions-br-df