Skip to main content

Voronoi Tessellation using Sweep-line algorithm

Project description

SweeplineVT -- Voronoi Tessellation using sweep-line algorithm

SweeplineVT github

pip install SweeplineVT

Description

  • Voronoi Tessellation on the basis of the sweep-line algorithm developed by Steven Fortune in 1986
  • Make centroidal Voronoi Tessellation (CVT)
  • Make Delaunay triangulation
  • Take accurate positions of points with no need of pixelation / binning.
  • Confine Voronoi diagram to a rectangular region

Examples

Make Voronoi Tessellation for a list of points

  • The content of "example.dat"
-0.5 1.5
1.1 3.3
2.9 5.7
3.1 4.3
5.4 2.6
6.3 3.1
slvt.py example.dat --calCentroid
pl_VT.py example_VT.dat example_ctd.dat -s

The red points are the Voronoi sites (input points from "example.dat"). The green lines connect each sites with the corresponding cell centroid.

example

Make centroidal Voronoi Tessellation (CVT) of 14 points in 0<x<7, 0<y<5.

slvt.py --makeCVT 14 --border 0,7,0,5 -s
pl_VT.py CVT14_VT.dat -s

"-s" of slvt.py means "silent". "-s" of pl_VT.py means "step".

  • One possible result you might see:
    CVT14

Show the distribution of cell area

from SweeplineVT import Voronoi
import pylab as pl
x=np.random.random(size=10)
y=np.random.random(size=10)
vor=Voronoi(events=np.vstack((x,y)).T,calArea=True,autoscale=False)
Area,ind,cts=vor.getarealist()
Area/=np.array(cts)
pl.hist(Area)

Output files

  • {FileName}_VT.dat: each item corresponds to one cell edge. The 9 columns are:
  • 1: index of edge
  • 2-3 and 3-4: coordinates of the two Voronoi vertices (nodes) of the edge
  • 5-6 and 7-8: coordiantes of the two nearest Voronoi sites (The Delaunay diagram)
  • With "--calCentroid", {FileName}_ctd.dat: each item corresponds to one cell. The 6 columns are:
  • 1: index of cell / site.
  • 2-3: Voronoi site of the cell
  • 4-5: centroid of the cell
  • 6: area of the cell
  • 7: site duplication number (>1 means duplicated)
  • With "--calArea", {FileName}_area.dat: each item corresponds to one cell. The 6 columns are:
  • 1: index of cell / site.
  • 2-3: Voronoi site of the cell
  • 4: area of the cell
  • 5: site duplication number (>1 means duplicated)

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

SweeplineVT-0.0.8.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

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

SweeplineVT-0.0.8-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

Details for the file SweeplineVT-0.0.8.tar.gz.

File metadata

  • Download URL: SweeplineVT-0.0.8.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for SweeplineVT-0.0.8.tar.gz
Algorithm Hash digest
SHA256 1633c5a9c2d666236f4eb67e3ef9c8dd5f166e3a15044ecf09ddc57acb8bb945
MD5 166bb9778b28632cd0dbb0ca90b8ce96
BLAKE2b-256 6372f0ed675fc5956707b35697436ff080a3b8dcdd2424632639d8c32d3da98f

See more details on using hashes here.

File details

Details for the file SweeplineVT-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: SweeplineVT-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 35.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for SweeplineVT-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 3298da96372259b7e0b426b8309e8d88babf46d28ea8370e47f7136d420f1e4d
MD5 6cf41766602a12004bb2fa9095936a19
BLAKE2b-256 4e0e5681cbec0b4186937b249200f35bbba052cb070b7f2aeb2ea3b8720a52d4

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