Implemented class: InteriorSampler2D | Method key: "poisson_disk"
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.
The algorithm operates in the 2D bounding box of the domain. The input is:
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.
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.
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.
This test is applied vectorially to all candidates at once after the Bridson algorithm finishes, making it computationally efficient.
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:
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().
k (int, default 30): Number of candidate attempts per active sample. Higher values give denser distributions at the cost of more computation. Bridson recommends k = 30 as a good default.seed (int or None): Random seed for reproducibility. Default: non-deterministic.n_max (int or None): Hard cap on interior nodes per entity. If set, a uniform random subset is selected.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.