Skip to main content

A wrapper for Boost’s Voronoi diagram library

Install

Dependencies

Cython dependency is optional. Cpp sources generated with Cython are available in releases.

Note on using the setup.py:

setup.py operates in 2 modes that are based on the presence of the dev file in the root of the project.

  • When dev is present, Cython will be used to compile the .pyx sources. This is the development mode (as you get it in the git repository).

  • When dev is absent, C/C++ compiler will be used to compile the .cpp sources (that were prepared in in the development mode). This is the distribution mode (as you get it on PyPI).

This way the package can be used without or with an incompatible version of Cython.

The idea comes from Matt Shannon’s bandmat library.

From PyPI

Cython not required.

pip install pyvoronoi

From source

Cython required.

Clone the repository:

git clone git@github.com:Voxel8/pyvoronoi.git

Install:

python setup.py install

After every modification of .pyx files compile with Cython:

python setup.py build_ext --inplace

Using

Create a new instance, passing the scaling factor into the constructor: ` import pyvoronoi pv = pyvoronoi.Pyvoronoi(10) `

Since the voronoi library uses integer representation for points, the scaling factor chosen must be high enough to avoid roundoff error when converting from point coordinates to integers.

Add points and segments:

pv.AddPoint([0, 0])
pv.AddSegment([[1,5],[2,2]])

Call Construct() and get the edges and vertices:

pv.Construct()
edges = pv.GetEdges()
vertices = pv.GetVertices()

Edges have the following properties:

  • start, end contain the indices of the start and end vertices or -1 if the edge is infinite at that end.

  • is_primary is true if the edge is not coincident with any of the source inputs.

  • site1, site2 are the indices of the sites which generated this edge. Sites are indexed as points, then segments, so if there are 5 points and 3 segments, a site index of 7 means the last segment, a site index of 2 means the third point.

License

  • Pyvoronoi is available under MIT license.

  • The core Voronoi library is available under Boost Software License. Freeware for both open source and commercial applications.

Release files for pyvoronoi 0.0.6

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

Source distribution (sdist)

Source distribution for pyvoronoi 0.0.6
File Size Uploaded
pyvoronoi-0.0.6.zip 111.7 kB Details

Release files / pyvoronoi-0.0.6.zip

Download URL pyvoronoi-0.0.6.zip
Size 111.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fbcb8f55cb0ffb5143e5f317e26ab448a0ce2e579c7681339bef841cf1f8e290
BLAKE2b-256 checksum
How to use checksums
72e2ef3b83aa767093ee39ead8f7e76af953a0f31795e17d040071c14b984e8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.2.8

43 release files

1.2.7

31 release files

1.2.2

49 release files

1.2.1

49 release files

1.1.9

63 release files

1.1.8

63 release files

1.1.7

63 release files

1.1.5

57 release files

1.1.4

74 release files

1.1.3

55 release files

1.1.0

1 release file

1.0.253

1 release file

1.0.24

1 release file

1.0.23

1 release file

1.0.20

1 release file

1.0.10

1 release file

1.0.8

2 release files

1.0.7

1 release file

1.0.6.1

1 release file

1.0.5

4 release files

1.0.4

1 release file

1.0.3

4 release files

1.0.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

1 release file

0.0.8

1 release file

0.0.7

This release

0.0.6 This release

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

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