bridson | Poisson Disc Sampling in Python | Data Manipulation library
kandi X-RAY | bridson Summary
kandi X-RAY | bridson Summary
Poisson Disc Sampling in Python
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Generate samples from a poisson distribution .
- Compute the euclidean distance between two vectors .
bridson Key Features
bridson Examples and Code Snippets
Community Discussions
Trending Discussions on bridson
QUESTION
I am writing an implementation of Bridson's Poisson disc sampling (https://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf) for Python.
A feature of this sampling is that there is a set minimal distance between samples, and it avoids clustering. The neighbour lookup for new candidate points exploits this feature, and uses a background grid to speed up searches.
The background grid consists of a boolean grid M
that stores True
for non-empty cells and False
otherwise, and a grid of points P
that stores the exact coordinates. Both of them are implemented as n-dimensional numpy
arrays.
The grid size cellsize
is selected in such a way that there is at most one sample in each grid cell, and then you only have to check a few of the nearest rows and columns.
For now, I use the following procedure for checking if the point p
is close to any of the existing points:
ANSWER
Answered 2021-Feb-06 at 09:22The dimensionality makes it a bit tricky. In the end, the overhead for preparing the sliced into an array was well worth it. Maybe a further optimization would be possible if you knew the dimensions beforehands. It shouldn't be too much of a difference. As an interesting part, this made the M matrix almost redundant - it is only used to check if the point itself is worth the try since the rest of the multiplication is sped up drastically by the slice.
Update:I re-introduced the M check as per comment and also used the np.square
instead of np.power
as op mentioned.
Time after the np.power > np.square transition:
QUESTION
I have seen lots of people implementing the 'Fast Poisson Disk Sampling' algorithm a.k.a Bridson (Paper of the algorithm, python Code). However, I haven't found anyone implementing it on a real dataset. Let's say, someone has a predefined dataset.
I would like to give my poisson disk algorithm the coordinates of the points with the amount of points I want to sample with a certain condition on the radius. Has anyone done this before? Is it doable? Any help is appreciated.
...ANSWER
Answered 2020-Nov-17 at 19:47Below is the code with examples posted on my github.
The code is not finalized yet, however, so far it works.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install bridson
You can use bridson like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page