logo
Kurashizu Blogwhere ideas flow
  • Home
  • News
  • Blog
  • About
  • Home
  • News
  • Blog
  • About

© 2026 Kurashizu. All rights reserved.

Admin·New Post·Service Status
Powered by Cloudflare·31.10.26
← Back to news

Poisson Disk Sampling

Original article
stripeacross.com|78 points|11 comments|by vismit2000|Sep 2, 2026

Understanding Poisson Disk Sampling

In 2024, a group of nine mathematicians produced a staggering, nearly 1,000-page proof regarding the geometric Langlands conjecture. It stands as a peak of pure mathematics—a work so complex that I've accepted I will likely never grasp the proof, or even the initial statements being proved.

Conversely, in 2007, Robert Bridson released a mere one-page paper. Despite its brevity, it has garnered nearly 1,000 citations and can be fully comprehended in under ten minutes. This paper solves a ubiquitous challenge in simulations and computer graphics: how to distribute objects randomly without them clustering too closely.

The Problem: Randomness vs. Order

Imagine you are procedurally generating a forest. If you use basic random sampling to place your trees, you encounter an immediate issue: trees will overlap some trees will be placed directly on top of one another.

To fix this, we need a way to enforce a minimum distance between any two points. A set of points that satisfies this constraint is known as a Poisson disk distribution.

Why not just use rejection sampling?

A naive approach would be to "throw darts" at the map and reject any point that falls within the minimum distance rrr of an existing point. However, this is inefficient because:

  1. Without a specialized data structure, checking collisions takes linear time.
  2. As the space fills up, the rejection rate rapidly approaches 100%.

Bridson’s Algorithm

To solve this efficiently, Bridson proposed an algorithm that works in ddd-dimensional space with a desired minimum distance rrr.

1. The Setup

First, partition the space into a grid where each cell has a side length of: cell size=rd\text{cell size} = \frac{r}{\sqrt{d}}cell size=d​r​ This specific size ensures that each grid cell can contain at most one point.

2. The Process

The algorithm maintains a list called active.

3. Sampling the Annulus

To find a new point, we sample an annulus (a ring) centered at ppp with an inner radius rrr and an outer radius 2r2r2r. To do this uniformly:

  1. Generate a random unit vector v⃗∈Rd\vec{v} \in \mathbb{R}^dv∈Rd.
  2. Pick a value xxx uniformly from the interval [12d,1)[ \frac{1}{2^d}, 1 )[2d1​,1).
  3. The final sample point is calculated as: 2rx1/d⋅v⃗2rx^{1/d} \cdot \vec{v}2rx1/d⋅v

Note: In 2D, picking v⃗\vec{v}v is as simple as choosing an angle θ∈[0,2π)\theta \in [0, 2\pi)θ∈[0,2π). In higher dimensions, you can normalize a vector composed of samples from a normal distribution.


Enhancing the Algorithm

There are two primary ways to reduce the number of iterations needed to fill the space. While the first is specific to 2D, the second is more general.

The "Parental" Optimization (2D)

When the algorithm generates a point qqq from a parent point ppp, we gain useful information. When we later sample the annulus around qqq, there is a specific "cone" of angles that we can ignore because any point in that region would inevitably be too close to ppp.

The Geometry of the Forbidden Cone: The cone is centered at angle α\alphaα with a total width of 2β2\beta2β:

α=atan2⁡(py−qy,px−qx)\alpha = \operatorname{atan2}(p_y - q_y, p_x - q_x)α=atan2(py​−qy​,px​−qx​) β=min⁡(arccos⁡∣p−q∣2+3r24r⋅∣p−q∣,arccos⁡∣p−q∣2r)\beta = \min\left(\arccos\frac{|p-q|^2+3r^2}{4r \cdot |p-q|}, \arccos\frac{|p-q|}{2r}\right)β=min(arccos4r⋅∣p−q∣∣p−q∣2+3r2​,arccos2r∣p−q∣​)

The min⁡\minmin function is critical here. Depending on the distance between ppp and qqq, the boundary of the forbidden zone is determined by either the inner or outer circle of the annulus. The transition occurs when the distance between points crosses 3⋅r\sqrt{3} \cdot r3​⋅r.

Implementation Steps:

  • Store the parent of every generated point.
  • Calculate α\alphaα and β\betaβ for the current point qqq relative to its parent ppp.
  • Generate the sample angle θ\thetaθ only from the range outside the [α−β,α+β][\alpha - \beta, \alpha + \beta][α−β,α+β] window.

Performance Comparison

MethodIterations RequiredComplexityNotes
Standard BridsonHigherO(N)O(N)O(N)Baseline efficiency
Parental Opt.Significantly LowerO(N)O(N)O(N)Faster convergence in 2D

(Based on trials with ℓ=100\ell = 100ℓ=100 and r=1r = 1r=1)

Final Considerations

While the parental optimization is powerful in 2D, its utility in higher dimensions is limited:

  • Storage: It would require storing more contact vectors.
  • Diminishing Returns: The volume of the intersection between an annulus and a sphere becomes proportionally smaller as dimensions increase.

One could theoretically store "children" as well as "parents" to prune even more of the annulus, but this would increase memory overhead and slow down the selection of θ\thetaθ.