Python bindings for the mapbox earcut C++ polygon triangulation library.
Project description
mapbox_earcut
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for mapbox_earcut-1.0.2-pp310-pypy310_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f96a52d8eaf041821d0aefaa53ea908fefede4f4826ab9384e0449314403478 |
|
MD5 | 973131521e5162e3057cce27c1029c77 |
|
BLAKE2b-256 | 4f4efa01058e372ce4a3f90290cb724b4258e3c9058620256b8eded8a417a4cb |
Hashes for mapbox_earcut-1.0.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6e44d5f5dbe2dd26c94de9a24ace47c034f86cb96d68fe01561334e4f50d5dc |
|
MD5 | a25028c4ee119ec2ad9bb93f9358ecc9 |
|
BLAKE2b-256 | c52fbda33f73623110aedc742e9771f65d9e3c9eb6d4b605f8c7eaf132cb3d4b |
Hashes for mapbox_earcut-1.0.2-pp310-pypy310_pp73-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a62e46c55b5b5256052954d0eb20a0ba5cc7019adfdb0ff8cfba15ecf781b0c5 |
|
MD5 | 8ad86f6a58f0fceaf37fb512acf35e43 |
|
BLAKE2b-256 | e7ac7632eca3e95404c60737aac8f578e1ca5cd09f9768e25469c60181d05d33 |
Hashes for mapbox_earcut-1.0.2-pp310-pypy310_pp73-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfc64fad3686a2ce2ea63a28c173580f489048a1cd36a4449959533bc5675788 |
|
MD5 | 24d6c486850503514809b6573f762fac |
|
BLAKE2b-256 | 9e0af00e080232b004d787430ca7e442c79925ed84a2cf69125e9f0455cfb5a3 |
Hashes for mapbox_earcut-1.0.2-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5444d9af72d23e581d0eaf1be342193c1f4c2bd2c8b70cdf692a58185b3637c0 |
|
MD5 | afd387b258e1f590a6df462832605974 |
|
BLAKE2b-256 | 2bbf0161412cdeadcadf81b5254831acfa72b62e1342c5c6e2bbd351ccc95f9f |
Hashes for mapbox_earcut-1.0.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37475996c833f3d95fbf721df0d88593f5a152b48a1a5603b7da3979911a6519 |
|
MD5 | 83335a1dc44e78e9ad324a60acc9338d |
|
BLAKE2b-256 | 4ac0ecc23f3f2dfb923c790bbe4bfff0d89c97779404a1609f6f0aaf9b1ddcac |
Hashes for mapbox_earcut-1.0.2-pp39-pypy39_pp73-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fc9597aa789d36d262a29b87432d6139def095ebd1499c035fa2123a393eacd |
|
MD5 | 90eb8594076f778360bbb52f8eb54533 |
|
BLAKE2b-256 | 75ee08887c93a1614cbb35f562751b7202072943f861272d68f4939aa11b29fe |
Hashes for mapbox_earcut-1.0.2-pp39-pypy39_pp73-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7483171c540c1e91dd2c6d5ac864cbe98ad70a460907b863c3ffb25cb4493416 |
|
MD5 | 4de44422094acaef0f9fdca41017a81d |
|
BLAKE2b-256 | 9264f56d5c8866f92c4dc1556c140b6a0f8765cdc23f74e4f60bc1639c0d9508 |
Hashes for mapbox_earcut-1.0.2-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1eb860bc40db2dd82d920835820cb5d5f488460dfef1dfc24f7a53f3c78bb59 |
|
MD5 | 8b7a380d662afc61b6870e07279595e7 |
|
BLAKE2b-256 | af65582a7e50beb21ac257cbbcd37d271cad947c2149adbe7ca6cb8ca2b72491 |
Hashes for mapbox_earcut-1.0.2-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c698c255f9e7f8b040fa5e886d44784db92617d4126851c484ac431065310af2 |
|
MD5 | 578c53224bd8c245b5ce5794b69f3980 |
|
BLAKE2b-256 | 9f734be5ca95dfce768efcfc0e86a99eba1421f3094e758c3b115ad0321d3237 |
Hashes for mapbox_earcut-1.0.2-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa187a1f18363fe6ecdbf46b1c5cca9b7fc4e4333fa95120ecd5f99cb6a3fb36 |
|
MD5 | 300be0faa1988c07bf321e5579c4dc62 |
|
BLAKE2b-256 | b7015a5465d94b1ec5bd6e7e6290cb9d54e1f31ba53307d07bc6d891b91e2fc4 |
Hashes for mapbox_earcut-1.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17cb7dcadb09eb239c1b0c47c7853ca3aa82d8828d5cd826a72ce53d61c1240b |
|
MD5 | af82d0ecb1c6c888faba3845ae151372 |
|
BLAKE2b-256 | 278b00f41544173e8fd3d3698c53a3f2f7017832888edc593cfa6456be346797 |
Hashes for mapbox_earcut-1.0.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c432668b46bf80c76cd03ea7ae3f8137c5de10dc78efd38197f4ce82a80f84b2 |
|
MD5 | 0b6098fece7a70789c9939965a7499de |
|
BLAKE2b-256 | bf6775605e3df2c26a42bb2c1c4c52dcc6b3ee882711fe939819eac81f588c1e |
Hashes for mapbox_earcut-1.0.2-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40c3d8d2ae66e184ef90874f26bf2678928587e8d6ec64388b226801c39dee8b |
|
MD5 | 274ba464c52cacd5a73ae08df4f0acd4 |
|
BLAKE2b-256 | 8ddfcef7d6d7bfea3d6ec12dac841277faca7c3eafdce7151acf5049a8302e2d |
Hashes for mapbox_earcut-1.0.2-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b3b1562da8545287097a8c5ddd8ee509350575e37e6185c047fe7710578fd80 |
|
MD5 | 7419b3cf1021ba6293fd133e0b0f03c4 |
|
BLAKE2b-256 | b94a58355c2f34141e20dbdb07273fec81d52d74951e06f8dd617b4deba65199 |
Hashes for mapbox_earcut-1.0.2-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 441f613ecafbed2608783f00584c89fa922c2cc954881204ed319a673d5dc762 |
|
MD5 | 58f185cb288b64f11e21b10b165baa38 |
|
BLAKE2b-256 | 57539b851e3bbb3562ae6db48976c8e44155e5b5698030cf1fb2d7cbd05c9d1c |
Hashes for mapbox_earcut-1.0.2-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5c6d9031ba3e72aa4431fff64a39e019948564cc0677f44a2a3949b4f19a466 |
|
MD5 | 8f0bfedfdae9194301be6536aa5baeed |
|
BLAKE2b-256 | fb6f8bd37c85cb72b685e9e0425d2f4cd31baef41e68d7afff390df5ab1ab765 |
Hashes for mapbox_earcut-1.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8945a66c511e01a5e3e5524351527e4c7c13a95c9c513db55420cdbbcffbcdc |
|
MD5 | 5318629ab5a394697d6c711fa90a2397 |
|
BLAKE2b-256 | d2f213624766fda6f76254218f99864acdb0b072ac6a50ba985055d5ee606de3 |
Hashes for mapbox_earcut-1.0.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 606dd427c554e8ddfba69b3283442410451a27222cb774ec348c3a30c0089d66 |
|
MD5 | b507ae07bb95f0e7876fd1c057bdcd27 |
|
BLAKE2b-256 | 36398a6bb2b7398f95aff063f65d7688632bf5e314ce52c053feb6a9a09caf3c |
Hashes for mapbox_earcut-1.0.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02d80b510e5ed078537bbb969eb852d7577d4053669546d71b376aa1ccd0296b |
|
MD5 | a856d8f2c96fa7de3fbd449e64a5f2b1 |
|
BLAKE2b-256 | bff131ea3f9392cf193c26427128cdbd0cdf39471e4bd9b18f9b23f3640d3ebb |
Hashes for mapbox_earcut-1.0.2-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df7451676d145f9157758ca44398eb9d385e844264113b84a4e0571946ad6253 |
|
MD5 | a8aa96770c501ef2f08d79906a5570b6 |
|
BLAKE2b-256 | f2b789eb081ae2674acafe0edb935641a2f87a5fe6ca52f60efb7439c0bfd522 |
Hashes for mapbox_earcut-1.0.2-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae990d62be6d2ed305b33845d4553def84711655b70bed1d26b50dd7ff9679d2 |
|
MD5 | 7fed39e894cd71abb3bb2249e9fa74ff |
|
BLAKE2b-256 | 52c54a41077fb5ce55c837aaf33bc5772d956c6f3b80ea458f48e71c105a1201 |
Hashes for mapbox_earcut-1.0.2-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af83d40e98729aefce4a9e4ab54af239856ae600de7384134df15534545bccad |
|
MD5 | 6fc907f0c37fc829845484f5e98bcfd0 |
|
BLAKE2b-256 | 277c5cde061adc6b59d7eb92e8b355d6b9ae3a7f5f493733428d1e571740d14f |
Hashes for mapbox_earcut-1.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f87262025203f258230823a1614d6d9ab10f327b4aacc15029e76c127cf471c |
|
MD5 | c2e84e19748de36cb71120297ba91ce8 |
|
BLAKE2b-256 | 171a3dd6024e705687cc8e7630f831b1d7ea3fe1069b6c0324e097736d984a37 |
Hashes for mapbox_earcut-1.0.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae5241af655f0148657b9de6c83782cae0c8d34f114957e128556273fc875f55 |
|
MD5 | 7607b1f17d50cb21838acfb9acaeffdf |
|
BLAKE2b-256 | e4fed248019dd2d9b274e879084d90e57be8c50edaea175437e1cc847fe0cffb |
Hashes for mapbox_earcut-1.0.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97203bf92a654f430d6aed9fde363a8fe25f2124b030bbe1a53860ce33ebd7a3 |
|
MD5 | ce8f6a317dc2b515f2c3072090275d8a |
|
BLAKE2b-256 | b35d04ff788d3ac6ecb49d9deffb38788cc89226e832e0fb62e0261e8088539d |
Hashes for mapbox_earcut-1.0.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ba2b51d4f336db774d9874a08ca47313a09f22a8368c7f7021c0c2768827b81 |
|
MD5 | f4949108efa307e6f336daadcfa5dd09 |
|
BLAKE2b-256 | 7acb6f21db92a9bdad5366c35a55f508f3a10da29bf3fee9327d5149056f5515 |
Hashes for mapbox_earcut-1.0.2-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 464f2469dba2d852b735dc7be1ff9bc3559555d1d985ac3af22f14042beb16f8 |
|
MD5 | 004ab71ce9d9b140fd95c52b5e771301 |
|
BLAKE2b-256 | 1980f3a897354f96b7e935865b25986c270d53470761f61c2415b4d3b6f88532 |
Hashes for mapbox_earcut-1.0.2-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49432419ada8a6d74fd827df0331faad52b21cbd39ff91d701aec5e5db553c51 |
|
MD5 | 809ef4b4e72530aff129b07a110ec52c |
|
BLAKE2b-256 | 474e835b7a82eebdc24149f1858894a94f6b32178d90b93bc1626c818474518f |
Hashes for mapbox_earcut-1.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72cfd7f6ff0d8dd19bd982661091e47d2878717584b390ec43e9f83dbfe60616 |
|
MD5 | 70670ac49d86dda1c05a05597d12844d |
|
BLAKE2b-256 | 541e994355157ae2a0fb6284d6aaa5bd93381e63a36dccb2ad1a83cf2e1bceeb |
Hashes for mapbox_earcut-1.0.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b0c83439dc69fadbd893886f49b952d27cb080745baeb1615ad5f0a0354e854 |
|
MD5 | e1bccbf96194a70c27ed36520edc61a2 |
|
BLAKE2b-256 | df344c5af67618fce02b9c777b53ffc289542cb772e91500da0025145b4ed542 |
Hashes for mapbox_earcut-1.0.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ef8096385d46b07b80bdbe9311bef6f19e777d82b9ea47de50a7f10c2ce08f4 |
|
MD5 | c29924ef2ac259ccbc16431ef7c28296 |
|
BLAKE2b-256 | 907766c980919d9beb962bf9626061ff30b980b382f6d4cac4faf503da349816 |