Skip to main content

Generate random shapes with ease.

Project description

random-shapes

Generate random shapes with ease.

Logo

Installation

You can install random-shapes via pip:

    pip install random-shapes

However, uv is recommended for installing python packages:

    uv add random-shapes

Usage

Install the optional library matplotlib for visualization:

    pip install random-shapes[viz]
    # or
    uv add random-shapes --extra viz

With random-shapes it is easy to generate a random shape (bezier.Curve):

    from random_shapes import get_random_shape

    shp = get_random_shape(n=10, r=0.05, edgy=0.2)
    shp.plot(pts_per_edge=10)

Random shape example

This shape can then be turned into a binary image:

    import matplotlib.pyplot as plt

    from random_shapes import bezier_polygon_to_binary_image

    binary_image = bezier_polygon_to_binary_image(shp)
    plt.imshow(binary_image, cmap="gray")

Binary image example

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

random_shapes-0.0.2.tar.gz (580.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

random_shapes-0.0.2-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file random_shapes-0.0.2.tar.gz.

File metadata

  • Download URL: random_shapes-0.0.2.tar.gz
  • Upload date:
  • Size: 580.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.5.24

File hashes

Hashes for random_shapes-0.0.2.tar.gz
Algorithm Hash digest
SHA256 06293fe1f2cc810efd1a65a1d0046ba1324e98ebc67104368a28757bb3c111f7
MD5 bac37798b5afca8057da08a5a7e6f4ac
BLAKE2b-256 d068ee6c710589a96a272d31c6d5a85d9f91b278d92bb13d4c2c28fe0fee3ef7

See more details on using hashes here.

File details

Details for the file random_shapes-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for random_shapes-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8a1e2e466d375ee6df4dd8880206815be64ffbe3e7738da6af329b2fa5d5b9a6
MD5 b428132172eeac50e397e39df17e3f5e
BLAKE2b-256 c13d3f230990f94a70e26815960d6a34c2229f976f8b9bcee2928adfb4924c96

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page