Skip to main content

Robust orient2d/3d, incircle, insphere predicates (Python port of robust-predicates v3.x)

Project description

pyrobust-predicates

Python port of mourner/robust-predicates (v3.0.x): adaptive-precision geometric predicates with the same y-down 2D convention as the JavaScript library.

Upstream pin: tests and fixtures target mourner/robust-predicates@v3.0.3. See docs/UPSTREAM_TESTS.md for how test/test.js maps to pytest.

This package backs dylaunator (mapbox/delaunator in Python) so Delaunay code can run without Node.

Requirements

  • Python 3.10+
  • Runtime dependency: mpmath (extended-precision fallback for incircle / insphere when the float filter is inconclusive; orient2d / orient3d follow the upstream expansion style in esm/)

Install

uv add pyrobust-predicates

API (matches upstream index.js)

Named exports are the same eight functions as npm:

Symbol Arguments Role
orient2d, orient2dfast 6 scalars (ax, ay, bx, by, cx, cy) 2D orientation
orient3d, orient3dfast 12 scalars 3D orientation
incircle, incirclefast 8 scalars In-circle
insphere, inspherefast 15 scalars In-sphere

Returns are numeric (typically float; fast paths may yield int). Compare to zero for the geometric sign; orient2d / orient2dfast are not identical on ill-conditioned input (upstream treats robust vs fast as different entry points).

Testing and coverage

uv run pytest packages/pyrobust-predicates -q
uv run pytest packages/pyrobust-predicates --cov=pyrobust_predicates --cov-report=term-missing

Includes a pytest port of upstream test/test.js (fixtures under tests/fixtures/*.txt), export parity checks, and small _util tests. Package source is kept at 100% line coverage under that configuration.

Upstream test fixtures

.txt files under tests/fixtures/ match upstream test/fixtures/*.txt at v3.0.3. Details: docs/UPSTREAM_TESTS.md.

Releasing (PyPI)

From this directory:

uv build
uv publish  # or upload dist/* with twine

Artifacts are written to the workspace dist/. Bump version in pyproject.toml and record changes in docs/CHANGELOG.md before each release. Publish this package before dylaunator, which depends on it.

License

Unlicense (public domain), matching upstream robust-predicates.

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

pyrobust_predicates-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

pyrobust_predicates-0.1.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file pyrobust_predicates-0.1.0.tar.gz.

File metadata

  • Download URL: pyrobust_predicates-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.14

File hashes

Hashes for pyrobust_predicates-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9e821ab6bc2307e24fd0d455a059fdda528db78b349af45fc728838dae804b80
MD5 0f1574691ef520dbb861d1690ec46cc1
BLAKE2b-256 bf4fe9580a0481ad0c91e1faac1dcc6f1b59e7def33b4a514ba8f6f6e4fa90e5

See more details on using hashes here.

File details

Details for the file pyrobust_predicates-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pyrobust_predicates-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80216aa9c98d8a9a22d5b110fd7227cf569f5b3716f0fa08b3347aad37362a38
MD5 4dc928e73e8ed4ff298a5d028211b22c
BLAKE2b-256 cc0dbae0f0c125216d0c9c50f60bd66f0167935b630f3e87672d67854d8d6cd2

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