Skip to main content

Python bindings for the mapbox earcut C++ polygon triangulation library.

Project description

mapbox_earcut

Build Status

Python bindings for the C++ implementation of the Mapbox Earcut library, which provides very fast and quite robust triangulation of 2D polygons.

Original code: earcut.hpp

Original description:

The library implements a modified ear slicing algorithm, optimized by z-order curve hashing and extended to handle holes, twisted polygons, degeneracies and self-intersections in a way that doesn't guarantee correctness of triangulation, but attempts to always produce acceptable results for practical data like geographical shapes.

Provided functions (depending on dtype of vertex data):

triangulate_float32
triangulate_float64
triangulate_int32
triangulate_int64

Example:

import mapbox_earcut as earcut
import numpy as np

# A Nx2 array of vertices. Must be 2D.
verts = np.array([[0, 0], [1, 0], [1, 1]]).reshape(-1, 2)

# An array of end-indices for each ring.
# The first ring is the outer contour of the polygon.
# Subsequent ones are holes.
# This implies that the last index must always be equal to the size of verts!
rings = np.array([3])

result = earcut.triangulate_float32(verts, rings)

# Result is an np.ndarray with dtype np.uint32 and shape (3,)
# containing indices into the verts array.

print(verts[result])
# [[1 0]
#  [1 1]
#  [0 0]]

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

mapbox_earcut-0.12.7.tar.gz (560.0 kB view details)

Uploaded Source

Built Distributions

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

mapbox_earcut-0.12.7-cp37-cp37m-win_amd64.whl (64.3 kB view details)

Uploaded CPython 3.7mWindows x86-64

mapbox_earcut-0.12.7-cp37-cp37m-manylinux1_x86_64.whl (67.5 kB view details)

Uploaded CPython 3.7m

mapbox_earcut-0.12.7-cp37-cp37m-macosx_10_6_intel.whl (54.7 kB view details)

Uploaded CPython 3.7mmacOS 10.6+ Intel (x86-64, i386)

mapbox_earcut-0.12.7-cp36-cp36m-win_amd64.whl (64.3 kB view details)

Uploaded CPython 3.6mWindows x86-64

mapbox_earcut-0.12.7-cp36-cp36m-manylinux1_x86_64.whl (67.4 kB view details)

Uploaded CPython 3.6m

mapbox_earcut-0.12.7-cp36-cp36m-macosx_10_6_intel.whl (54.7 kB view details)

Uploaded CPython 3.6mmacOS 10.6+ Intel (x86-64, i386)

mapbox_earcut-0.12.7-cp35-cp35m-win_amd64.whl (64.3 kB view details)

Uploaded CPython 3.5mWindows x86-64

mapbox_earcut-0.12.7-cp35-cp35m-manylinux1_x86_64.whl (67.5 kB view details)

Uploaded CPython 3.5m

mapbox_earcut-0.12.7-cp35-cp35m-macosx_10_6_intel.whl (54.7 kB view details)

Uploaded CPython 3.5mmacOS 10.6+ Intel (x86-64, i386)

File details

Details for the file mapbox_earcut-0.12.7.tar.gz.

File metadata

  • Download URL: mapbox_earcut-0.12.7.tar.gz
  • Upload date:
  • Size: 560.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for mapbox_earcut-0.12.7.tar.gz
Algorithm Hash digest
SHA256 dbddc079b9ba9b458bb5d2ad0bfe0364ae2803b1d9520411e0cf0ee32d5993c8
MD5 556705eaf28192324dc736275800f1ed
BLAKE2b-256 4aaab516bb6976183ca31f59d1163ce95b8d08a5e46e19d161cc840a08a6dfa7

See more details on using hashes here.

File details

Details for the file mapbox_earcut-0.12.7-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: mapbox_earcut-0.12.7-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 64.3 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

File hashes

Hashes for mapbox_earcut-0.12.7-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 662207e5627deb10fb464ef6b73fdd3621d6bf65cbe6cdf0af734fbf8cca3b9c
MD5 cf86c4b2263af1033306aa880db8256f
BLAKE2b-256 180f80b59829702b10897809565ab0403577deceed64e882cc7e1b563c482f39

See more details on using hashes here.

File details

Details for the file mapbox_earcut-0.12.7-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: mapbox_earcut-0.12.7-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 67.5 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

File hashes

Hashes for mapbox_earcut-0.12.7-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 159f607c330b58c0d80bda2fe3b904a30d3f6cb360598b196f4090968231c491
MD5 93fe1d24b29a0e4ced72406144dd20cc
BLAKE2b-256 491bc58062ab81e689ffa02670b8f7cf4a79cbdfb3ce7ec4522dec07d5e8178e

See more details on using hashes here.

File details

Details for the file mapbox_earcut-0.12.7-cp37-cp37m-macosx_10_6_intel.whl.

File metadata

  • Download URL: mapbox_earcut-0.12.7-cp37-cp37m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 54.7 kB
  • Tags: CPython 3.7m, macOS 10.6+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

File hashes

Hashes for mapbox_earcut-0.12.7-cp37-cp37m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 f63f9d88c9a35f8ecf18d698ab73af154e900b71eacec9ef716a71fa69da5012
MD5 b3711f6b8fe1cae24d31e583e08f1507
BLAKE2b-256 cbea4fbad2aaca0d8359da18946aaf57cfb0d63ba654cd4f573d66b8d6e5b539

See more details on using hashes here.

File details

Details for the file mapbox_earcut-0.12.7-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: mapbox_earcut-0.12.7-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 64.3 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

File hashes

Hashes for mapbox_earcut-0.12.7-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 7efdc4a4f2ac96bf26087043ba14cb80df0ec6829539afa725e6f633a373995f
MD5 2636331d23d702106fd086f351bcf530
BLAKE2b-256 061e1eaaf1ad91b8aea22d052238c9cc72bc752ccce57f9b5f3e88a847fb1769

See more details on using hashes here.

File details

Details for the file mapbox_earcut-0.12.7-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: mapbox_earcut-0.12.7-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 67.4 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

File hashes

Hashes for mapbox_earcut-0.12.7-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f310863fedadc6ce9f258a87fe4938c51e596857905970d6c71b2f154f0a3ad3
MD5 2182db8ede6328e843c353ea7522c73f
BLAKE2b-256 22effd4990c027875800c09c8828545d14e611c415c8aebf8bf392b997d7c447

See more details on using hashes here.

File details

Details for the file mapbox_earcut-0.12.7-cp36-cp36m-macosx_10_6_intel.whl.

File metadata

  • Download URL: mapbox_earcut-0.12.7-cp36-cp36m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 54.7 kB
  • Tags: CPython 3.6m, macOS 10.6+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

File hashes

Hashes for mapbox_earcut-0.12.7-cp36-cp36m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 5620717ae260d88ea4847a11147a1d31f7e4d0149d972eee7b6d8478062cb552
MD5 fbba8e8629bf2b3bdcf93cbbff2383f6
BLAKE2b-256 8d3468a4917027a7db57b942319fdb6a3221fd61aad3a22e1e431ee0b3ef5867

See more details on using hashes here.

File details

Details for the file mapbox_earcut-0.12.7-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: mapbox_earcut-0.12.7-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 64.3 kB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

File hashes

Hashes for mapbox_earcut-0.12.7-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 fab22738446d5b9be77536937aa3a2654f75c3558e224e68f8b188e12aa57d3f
MD5 5d13bce6b3fac7df5b5b3be1b3c732d5
BLAKE2b-256 2331addd643afa977a79f9871e0dee5ed937917466578d8d24654aad4a3bb381

See more details on using hashes here.

File details

Details for the file mapbox_earcut-0.12.7-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: mapbox_earcut-0.12.7-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 67.5 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

File hashes

Hashes for mapbox_earcut-0.12.7-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c72dbde597b4fd8b0512bb3e5354dbc341e5082342709ad7244cc02a54242160
MD5 f80388783710756ae91d18f982d089d9
BLAKE2b-256 23fc8cec94ae2a38dab64ac5e5856a870517f7724cecd70491d7134914b014ef

See more details on using hashes here.

File details

Details for the file mapbox_earcut-0.12.7-cp35-cp35m-macosx_10_6_intel.whl.

File metadata

  • Download URL: mapbox_earcut-0.12.7-cp35-cp35m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 54.7 kB
  • Tags: CPython 3.5m, macOS 10.6+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

File hashes

Hashes for mapbox_earcut-0.12.7-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 e4cbfbc1181d5bb0f37eb0f359531b70bd94d64090b45bfa3c2b03ecaa29ceff
MD5 84a1d99e6067a116814b2c2a574614ea
BLAKE2b-256 00478e0a5ac2e48bf810d4df094633c7ce78bb8581c31e245d02ad6d9e77e635

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