Poisson Disc Sampling

An asset by udit
The page banner background of a mountain and forest
Poisson Disc Sampling image holder but it is empty

Quick Information

0 ratings
Poisson Disc Sampling icon image
udit
Poisson Disc Sampling

Script for generating evenly and randomly distributed points for a given region (rectangular, polygonal or circular) separated by a minimum distance.

Supported Engine Version
3.2
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
4 years ago
Git URL
Issue URL

Poisson Disc Sampling

Poisson Disc Sampling GDScript for Godot. Generates evenly and randomly distributed points for a given region (rectangular, polygonal or circular) separated by a minimum distance. Points are sorted in the order of their discovery, so it can be used to create interesting animations.

Available on Godot Asset Library: https://godotengine.org/asset-library/asset/559

How to use

  • Create an instance of class PoissonDiscSampling
  • Call generate_points(radius: float, sample_region_shape, retries: int, start_pos: Vector2):
    • radius - minimum distance between points
    • sample_region - any of the following types:
      • Rect2D for rectangular region
      • Array of Vector2 for a polygonal region
      • Vector3 for a circular region with x, y as the position and z as the radius of the circle
    • retries - number of retries to search for a valid sample point around a point. 30 is sufficient, but you can reduce it to increase performance. A very low number will give unevenly spaced distribution.
    • start_pos - starting position is optional. A random point inside region is selected if not specified.
var poisson_disc_sampling = PoissonDiscSampling.new()
var points = poisson_disc_sampling.generate_points(20, $Polygon2D.polygon, 30)
Further Reading

Script for generating evenly and randomly distributed points for a given region (rectangular, polygonal or circular) separated by a minimum distance.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Poisson Disc Sampling icon image
udit
Poisson Disc Sampling

Script for generating evenly and randomly distributed points for a given region (rectangular, polygonal or circular) separated by a minimum distance.

Supported Engine Version
3.2
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
4 years ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers