Skip to main content
https://img.shields.io/pypi/v/poisson-d.svg

Poisson disk implementation in python

  • Free software: MIT license

Features

  • Generate poisson disk coordinates on a grid

  • Generate points with charactoristics of poisson disk from an image

  • Generate points with charactoristics of poisson disk from CMYK channels of an image

Usage examples

  • Use poisson-d module, from Grasshoper Python Script Component, to generate points of poisson disk

# requirements: poisson-d==latest
import rhinoscriptsyntax as rs
import imageio.v3 as iio
from poisson_d import poisson_d as p

# remove the follow two lines if you want take these two parameters as input variables
max_points = 30000
white_threshold = 0.8

# input variables: img_path, radius_min, radius_max
# output variables: coordinates (list of Point3D), greys (list of floats)

image = iio.imread(img_path)

result = p.poisson_d_variant(
    img=image,
    radius_min_max=(radius_min, radius_max),
    max_points=max_points,
)

print(f"generated {len(result)} points")

result = p.filter_out_white(result, white_threshold)

coordinates = [rs.CreatePoint(pn.x, -pn.y, 0) for pn in result]
greys = [x.grey for x in result]
  • Use poisson-d module, from Grasshoper Python Script Component, to generate points of poisson disk on C, M, Y, K channels

# requirements: poisson-d==latest
import rhinoscriptsyntax as rs
import imageio.v3 as iio
from poisson_d import poisson_d as p

# remove the follow two lines if you want take these two parameters as input variables
max_points = 30000
white_threshold = 0.9

# input variables: img_path, radius_min, radius_max
# output variables: c_points, m_points, y_points, k_points for coordinates; c, m, y, k for greyscales

image = iio.imread(img_path)

((c_points, m_points, y_points, k_points), (c, m, y, k)) = poisson_d_cmyk(
    img=image,
    r=(radius_min, radius_max),
    cnt=max_points,
    th=white_threshold,
)
  • Generate points of poisson disk from an image

install the poisson-d module

python3 -m pip install poisson-d --upgrade

now generate an image

python3 -m poisson_d.cli image --image input/sample.png
  • Generate points of poisson disk in text format, from an image

python3 -m poisson_d.cli points --image input/sample.png

Credits

This package was initialized with Cookiecutter.

Release files for poisson-d 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for poisson-d 0.5.0
File Size Uploaded
poisson_d-0.5.0.tar.gz 18.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for poisson-d 0.5.0
File Interpreter ABI Platform
poisson_d-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.6 kB

Release files / poisson_d-0.5.0.tar.gz

Download URL poisson_d-0.5.0.tar.gz
Size 18.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6c778e7016b0147b065aefd8d7da91a4697472a12dd7df1d11359322f47ca554
BLAKE2b-256 checksum
How to use checksums
f83fa0c9a34cc46215a44939e8abcbe1a4e84888ac35b1518a86fdbc9c13c479
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / poisson_d-0.5.0-py3-none-any.whl

Download URL poisson_d-0.5.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dfe8f5233b5da5eff3f1db8c5fe2db9fd9397b74a30d32c122cb5914f2d3a96b
BLAKE2b-256 checksum
How to use checksums
b935d33b47b76af43440c1e3d9fb376575895be3b489eb57da5419c9a41e5c0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.10

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.8

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page