Poisson Disk Interior Sampling (Bridson 2007)

Implemented class: InteriorSampler2D  |  Method key: "poisson_disk"

1. Motivation

Interior node generation for meshfree analysis requires a point distribution that is:

The Poisson disk distribution satisfies all these requirements. A Poisson disk sample set is a maximal set of points such that no two points are closer than a minimum distance rmin. The term "Poisson disk" comes from the fact that such a distribution has a power spectrum similar to blue noise — the Fourier transform of a 2D Poisson process, but with a hard exclusion radius.

The original problem of generating Poisson disk samples was expensive (O(N2)). The Bridson (2007) algorithm generates exact Poisson disk samples in O(N) time using a background acceleration grid, and is the standard method used in meshfree, SPH, and computer graphics applications.

2. The Bridson Algorithm

The algorithm operates in the 2D bounding box of the domain. The input is:

Algorithm (Bridson 2007)

  1. Initialise a background grid with cell size c = rmin / √2. Each cell stores at most one sample index. This cell size guarantees that in a 2×2 neighbourhood of cells, at most one sample can conflict with a new candidate.
  2. Choose a random seed point x0 uniformly within the bounding box. Add it to the sample list and the active list.
  3. While the active list is non-empty:
    1. Pick a random active sample xi.
    2. Generate up to k candidate points uniformly at random in the annulus rmin ≤ |c - xi| ≤ 2 rmin.
    3. For each candidate c: check whether it is within the bounding box and at distance ≥ rmin from all existing samples in the 5×5 neighbourhood of grid cells. If both checks pass, accept c as a new sample, add it to both lists, and continue to the next active sample.
    4. If no candidate is accepted after k attempts, remove xi from the active list (it is "retired").
  4. Return the sample list.

The cell size c = rmin / √2 is chosen so that the diagonal of a cell equals rmin. This guarantees that two points in the same cell are closer than rmin — therefore, each cell contains at most one accepted sample. The neighbourhood check covers a 5×5 window (cells at distance ≤ 2 in each axis), which is sufficient because a circle of radius rmin can overlap at most 25 cells of side c.

2.1 Complexity

The background grid makes each neighbourhood check O(1). Each sample is added to the active list at most once. The total number of active list operations is O(N), where N is the number of accepted samples. The expected total work per sample is O(k) candidate evaluations, so the overall complexity is O(k N) = O(N) for fixed k.

3. Domain Containment Test

Since the algorithm generates candidates in a rectangular bounding box, a containment test is applied to keep only points that lie strictly inside the face boundary polygon. The test is performed using the ray casting algorithm (implemented via matplotlib.path.Path.contains_points()): a point is inside if a ray from that point in an arbitrary direction crosses the boundary polygon an odd number of times.

xi ∈ Ω ⇔ ray from xi crosses ∂Ω an odd number of times

This test is applied vectorially to all candidates at once after the Bridson algorithm finishes, making it computationally efficient.

4. Projection to 3D

The Bridson algorithm operates in 2D (in the local coordinate system of the planar face). Each accepted 2D point (u, v) is lifted back to 3D by:

x3D = O + u · x̂ + v · ŷ

where O is the origin of the face plane, x̂ and ŷ are the in-plane axes extracted from the OCC face geometry via BRep_Tool.Surface().

5. Parameters

Limitation: The InteriorSampler2D generates interior nodes independently from boundary nodes. This means the minimum distance from an interior node to a boundary node is not guaranteed to be ≥ h — a narrow boundary layer may exist where interior and boundary nodes are closer than intended. For applications requiring consistent spacing everywhere, use "poisson_disk_boundary_aware" instead.

6. References