Skip to main content

Python library for calculating geodesic distance on triangular based surface meshes

Project description

pygeodesic

Python library to compute geodesic distance over a triangular based surface mesh.

A Cython wrapper of the C++ code by Kirsanov, which is an implementation of the exact geodesic algorithm for triangular mesh first described by Mitchell, Mount and Papadimitriou in 1987.

pygeodesic is similar to other libraries on PyPi (such as gdist and tvb-gdist), but:

  • provides a wrapper of the GeodesicAlgorithmExact class
  • exposes geodesic path (not just geodesic distance)
  • licensed under MIT license similar to the orginal Kirsanov C++ code, rather than GPL

A good alternative to pygeodesic is potpourri3d, which uses the heat method and vector heat method to compute geodesic distance over surfaces and point clouds. However, this library does not currently output the geodesic path on the surface.

Requirements

A C++ compiler is required if you are not installing one of the precompiled wheels. Although pygeodesic is a Cython wrapper, Cython is not required as the cythonized C++ file is also provided.

VTK is used for visualisation in the example notebooks.

Installation

Install from PyPi:

pip install pygeodesic

Installation from source (from within folder containing setup.py):

python setup.py install

Usage

Loading pygeodesic:

import pygeodesic.geodesic as geodesic

To read the mesh files provided with the original C++ code:

filename = r'data/flat_triangular_mesh.txt'
result = geodesic.read_mesh_from_file(filename)
if result:
    points, faces = result

To calculate the geodesic distance and path between two points (the source and the target) on the mesh:

# Initialise the PyGeodesicAlgorithmExact class instance
geoalg = geodesic.PyGeodesicAlgorithmExact(points, faces)

# Define the source and target point ids with respect to the points array
sourceIndex = 25
targetIndex = 97

# Compute the geodesic distance and the path
distance, path = geoalg.geodesicDistance(sourceIndex, targetIndex)

To calculate the geodesic distances from a single point (the source point) to all other points on the mesh:

source_indices = np.array([25])
target_indices = None
distances, best_source = geoalg.geodesicDistances(source_indices, target_indices)

To calculate the geodesic distances from two source points to 3 target points:

source_indices = np.array([25,100]) 
target_indices = np.array([0,10,50])
distances, best_source = geoalg.geodesicDistances(source_indices, target_indices)

For more detail, a Jupyter notebook is provided in the examples folder to show how to use pygeodesic to compute geodesic distances and paths.

Example using the Stanford Bunny

A Jupyter notebook is provided showing how to use pygeodesic to calculate the geodesic distance and path using the Stanford Bunny as an example.

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

pygeodesic-0.1.9.tar.gz (36.3 kB view details)

Uploaded Source

Built Distributions

pygeodesic-0.1.9-cp312-cp312-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.12 Windows x86-64

pygeodesic-0.1.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pygeodesic-0.1.9-cp312-cp312-macosx_10_9_x86_64.whl (251.8 kB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pygeodesic-0.1.9-cp312-cp312-macosx_10_9_universal2.whl (348.9 kB view details)

Uploaded CPython 3.12 macOS 10.9+ universal2 (ARM64, x86-64)

pygeodesic-0.1.9-cp311-cp311-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.11 Windows x86-64

pygeodesic-0.1.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pygeodesic-0.1.9-cp311-cp311-macosx_10_9_x86_64.whl (253.6 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pygeodesic-0.1.9-cp311-cp311-macosx_10_9_universal2.whl (351.1 kB view details)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

pygeodesic-0.1.9-cp310-cp310-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.10 Windows x86-64

pygeodesic-0.1.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (984.3 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pygeodesic-0.1.9-cp310-cp310-macosx_10_9_x86_64.whl (253.1 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pygeodesic-0.1.9-cp310-cp310-macosx_10_9_universal2.whl (350.7 kB view details)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

pygeodesic-0.1.9-cp39-cp39-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.9 Windows x86-64

pygeodesic-0.1.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (984.1 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pygeodesic-0.1.9-cp39-cp39-macosx_10_9_x86_64.whl (253.9 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pygeodesic-0.1.9-cp39-cp39-macosx_10_9_universal2.whl (351.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)

pygeodesic-0.1.9-cp38-cp38-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.8 Windows x86-64

pygeodesic-0.1.9-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (882.8 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pygeodesic-0.1.9-cp38-cp38-macosx_10_9_x86_64.whl (145.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

pygeodesic-0.1.9-cp38-cp38-macosx_10_9_universal2.whl (350.4 kB view details)

Uploaded CPython 3.8 macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file pygeodesic-0.1.9.tar.gz.

File metadata

  • Download URL: pygeodesic-0.1.9.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for pygeodesic-0.1.9.tar.gz
Algorithm Hash digest
SHA256 284fde6ffa4d886a2d3a571a21ec19f1f6cbdfe79623ebcea6f5740ea08a0ff1
MD5 3d66530d0a3c77adaa69e404f272acf7
BLAKE2b-256 767ed6093f42282d4b6a070b5985feaf7e63ca9a74e655d0de85b9934ae4f3ef

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 23d70b22c98b23697698f5ba4e49c42f6afe5374b4797a10e5bbac87dfa8687b
MD5 27b19854f028eb4194c9e77f7a180e85
BLAKE2b-256 250c3aaaa4302d0bb3272c68550b2f7d2166e1f00164d780cb64b959b05d31d7

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cedb48a9842ec0b1e3c5f1a71925b9690e2a16d46c2259cfdea878525fc82c18
MD5 666ea56824fa6d65f73252810cd94fdc
BLAKE2b-256 d2ffb2f9d49a88dc8bc5f3f03fe1fba48f46b9e719c3a4c474faeaf331b8d496

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 58c949f9131f4c3896c84fe7fb80be0647a81189e2323ae64d4fb1c038411e21
MD5 84b2b92101068d26055c5c00f15adee8
BLAKE2b-256 18da38743f690bf88a19e451fc2e461f46b7bf5e8faa318f8ae23eb144671dba

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp312-cp312-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 c418cccd6f8a49a56eaca5cf46b14806e4780f4885caf96468d914a818d36e63
MD5 15edcbbc0b963de51936c160b00d21bc
BLAKE2b-256 e084bc1e17637ac733227d636efa018241b50c95922e8f617edded2384881ebc

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b1860999dc588f83ff360886514fa5f73e8ec9d39044bd39155fdf328bc1b7f4
MD5 b660e9fa704c0d1fc1bf2e7957a4dedf
BLAKE2b-256 f09b8e10a97a88a5a862687a8c3a25ab1c363690c639afa69c9290c052a0015e

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 845bbe70aca4f316bb9fc8b7456cd51e3d0e0c99d7e9fbe934431ac5cbacf5cc
MD5 5f3dbe8195e695ed9c3b472e41236b22
BLAKE2b-256 4f1060f7d6a57efa7b3f06eb51f179a37d02d8add066e39929842e07c7851334

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 02944ef15225b9ba88e69d79bedbd993cd960c6bfd8b9306cf8e59eab13b40fe
MD5 da0b94aa0892ea17dd70f52b741a63fb
BLAKE2b-256 0a2b98fe52c8a36a1e159e0808cb3fbcd3c955c16d0cf281a3d8ceba9a200283

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 5761b200e076f3b25c5415b72f0d360bd4d930d5448e5ec684d3470d46b441a9
MD5 fd60840ed090267f3358fe28b418e78f
BLAKE2b-256 c82a4535c2f3e872ed0645862d1bf66e38fbfa6fa6932a37f30868c98f2bc538

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a18f735e9b7a90850cbe757285f9301fae675386278ed0c9d2ca04ef06a8134b
MD5 4cc9c732ea38dfb6c5b90b2ebd98740f
BLAKE2b-256 c64a1de57966cc7a435fb3846cb12d7978c9442ae0291bc9ba4e7838917676aa

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 da7c3d00f1e85338e7a2702e358415077dfbbda9102c63d925745e5806c563e4
MD5 e0c628437343a76fcbb92f9b7fd21b00
BLAKE2b-256 2026c961241341eb81fa040308d512dd9c7292893a3111f8608ede6c1e23ad51

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f90e4aa31c5c40d3730a2d850671aabf8dafbe39e0629ffe37ccca50472dfa7b
MD5 d185297f45b05fd1e30e9482f50b93ae
BLAKE2b-256 dca5c6909ec34bdb0dbbe4c0280eb74edb9f055f31d257e50a9006913a70db8f

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 c9045a1e263aafa3d0ecb95be9366feeac2f6ebfd7949e7fef3b8c64aef60f46
MD5 cfd9d83d922965b30ba72abab7eae32d
BLAKE2b-256 618fd4d2e90d2edd196528773137343466a8cd702b5f81519a64b7b4e87594a6

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 fb1c0cd747280058d1d9f1b90f7430617b3705ef59c25367b7ecb7122d03a5b0
MD5 a781f8798bb1dc6a46c4caa4f5c52142
BLAKE2b-256 7b8ac068a9a167032c083d4a3300f9243af8aae789e55e56c4bfa9b7299bc7ed

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cf18f7af1419f5ec556ba3c03e0fa93cec3ef3c8a86a2c22278ee3ebe089a399
MD5 711938ed1662823be46b3ab66206e766
BLAKE2b-256 0b2af07e0245ab10570f5e85c630f05ade4e879ec903b415e3beb82bfde4331c

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0152bade11d9a94950d997593f860a6a5a214e59885ae99736e4d6280ba145bd
MD5 ca9fb479ae4ad3c29b3c817710d43c12
BLAKE2b-256 9111a76409772a577d9e37d798f7204b7ff57b0231cbd35f3954f3968a556380

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 35bcbc4cd5c02c6bd89c37ac465263edc9e3c70a6c717ebbce225d10a64cc3e4
MD5 f53103745609f386768d283557bc5711
BLAKE2b-256 463c08408de0f9bf7bb9440f46b35bb2b7fedfa031dbdb509bc9f1227c7bd88d

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 5edb6b4a77b4d32958747c9831a22aa06269e26321db413b73248a17610c58bc
MD5 7b68c47a39445535214b6b522fb7f026
BLAKE2b-256 e9973f4fd29c8402bd02772cffd4befc5032edd63fa04098a841e7b212b09583

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 714cfe7e7ea0705e2c224008b17d07eb2425a13116e1ac4b7ced01f1f5059fd5
MD5 d3baa5905d6a813352a3ca525445f3c4
BLAKE2b-256 83e14170d2b3206afb8f380ce7a6f87516828818390edca840cef55d49210c07

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b632b3aaf63f0ec442bb431177a8e6b6fc7f26011b85469f33860d37bf8aebca
MD5 31cc8e106bea34681eb8860d9848abf6
BLAKE2b-256 18e603603cdd9b68467b8227f7da0654f8f8da56ff40814e2a5749cb3cf9c346

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.9-cp38-cp38-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.9-cp38-cp38-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 a6d7771fb2f5af95540cd04a3c31719d5014bc680290a69555cdeec98c7c85c1
MD5 8985451f25d1bc671bf9460cff8ac79d
BLAKE2b-256 f7eeccb2674aeaa2db95d2c57cc7d409f7182ede3f87a55a4b28c3dc784fb168

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page