Octree Construction
Stage 1 of five. Operates on cells. See Hexahedral Meshing from a Surface for the pipeline overview and terminology.
The octree is sized from the shape diameter function (SDF) of the tessellation, a per-facet estimate of the local thickness of the solid, obtained by casting rays inward from each facet and measuring the distance to the opposite side.
Let denote the --scale argument, the smallest positive shape diameter — the thinnest part of the model — and the largest extent of the surface bounding box. Then the finest cell size and the maximum tree depth are
Each symbol has a direct physical reading:
| Symbol | Is | Measured in |
|---|---|---|
| thickness of the thinnest part of the solid | length | |
| edge length of the root cell, which encloses the model | length | |
| edge length of the smallest cell the tree may create | length | |
| how many cells are placed across the local thickness | count | |
| how many times the root may be halved to reach | count |
The one to build intuition on is . Rearranging gives : the thinnest feature is spanned by exactly cells. And because the octree stops subdividing a cell once it is no larger than the local thickness divided by , this holds throughout the model, not just at its thinnest point.
--scaleis the number of cells placed through the thickness of the solid. At--scale 4, a thin plate gets four cells through its thickness, and so does a thick block through its own.
and then follow as bookkeeping: is the resolution the thinnest feature demands, and is the depth needed to reach that resolution from a root cell of size , since halving times gives .
The figure shows a 2D quadtree analogue at for a dumbbell — two thick lobes joined by a thin bar. Note that the fine cells appear only along the thin bar; the lobes are meshed coarsely, because four cells across their thickness is a much larger cell. The red square is the finest cell , sized by at the bar.
Three consequences are worth stating plainly:
--scaleis not a tree depth. It is a divisor on local thickness. Because depth enters logarithmically, doubling--scaleadds approximately one level of refinement, not twice as many.- Refinement is local, not global. A thin feature is refined finely; thick regions elsewhere are not. A sliver raises the depth budget , but only cells near the sliver actually descend to it.
- Refinement is surface-driven. Cells are subdivided only where they straddle the surface. The deep interior of a thick region stays coarse regardless of .
The default is --scale 3, which is deliberately coarse. Meshes of any detail generally require considerably more; see Choosing a Scale.
Next: Equilibration, which balances and pairs the octree this stage produced.