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.11.tar.gz (36.3 kB view details)

Uploaded Source

Built Distributions

pygeodesic-0.1.11-cp313-cp313-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.13Windows x86-64

pygeodesic-0.1.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pygeodesic-0.1.11-cp313-cp313-macosx_11_0_arm64.whl (251.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pygeodesic-0.1.11-cp313-cp313-macosx_10_13_x86_64.whl (257.3 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pygeodesic-0.1.11-cp312-cp312-macosx_11_0_arm64.whl (252.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pygeodesic-0.1.11-cp312-cp312-macosx_10_13_x86_64.whl (258.1 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pygeodesic-0.1.11-cp311-cp311-macosx_11_0_arm64.whl (252.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pygeodesic-0.1.11-cp311-cp311-macosx_10_9_x86_64.whl (259.0 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

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

Uploaded CPython 3.10Windows x86-64

pygeodesic-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (986.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pygeodesic-0.1.11-cp310-cp310-macosx_11_0_arm64.whl (253.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pygeodesic-0.1.11-cp310-cp310-macosx_10_9_x86_64.whl (258.8 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pygeodesic-0.1.11-cp39-cp39-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.9Windows x86-64

pygeodesic-0.1.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (877.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

pygeodesic-0.1.11-cp39-cp39-macosx_11_0_arm64.whl (143.7 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pygeodesic-0.1.11-cp39-cp39-macosx_10_9_x86_64.whl (149.4 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pygeodesic-0.1.11.tar.gz
Algorithm Hash digest
SHA256 a9b54eb20d57f5499d8b2a4a67ece675a44c6fc8d00b11e8c14c8c99edeee5ed
MD5 b16534fa2ca253720fab0220be0ce83b
BLAKE2b-256 6633174106049bdea633e537f14fc39ebc68f2f97994591911b4e64e4870803c

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.11-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a76e838faf172001a12ca4cab6f6df17fc5e8cba13dd2317675df83e8a14c9ae
MD5 ddb809e4d1f3e21cef8a174bb26d1222
BLAKE2b-256 9829967ad2b817a530a866ee9531452439bd1f1bf61c564b2fb85f37741795a5

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 667dbfc3692b0d205140275157e6275d05910de9b3cecadff2d439ebb5386e8d
MD5 f9d25de77f24ce0f7283cd4c5095709f
BLAKE2b-256 7dd4c0e2fa21ca048e0199a3bee1438d5fef6591b65d2c856d8b7934c9bb5af7

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.11-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4ebb75522b7e668a056ae33958d912dfbf5f6926048eb581cd1411c109a60475
MD5 bbfe80027dce83bdb90dcee33c6050e4
BLAKE2b-256 28ea37deeb6c02599048ee1a05750a119744e394d2f746f2f51cf5e02f030ed2

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.11-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 223e77235d0cefafb9b37ab2bcd8b99f94d4f819dfcf18c32e6f83d270eaf614
MD5 9d4b2697df442a8f83b1c8d5879a08f4
BLAKE2b-256 1f03b7e5e98cc2a1a738d07daf6a2736b6c83c394e997ddca41a675eed11ae1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 585e6fd35babbda2fa9b87f23d05e0ec26e1e416e069997ed137ac04b94f05b9
MD5 b58b27a66867c6367e95c6e8f7ae4591
BLAKE2b-256 e60b03af381ad00eaf56dde8156d48c0c4b7c5b928dd128221619d8b3cfea901

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 495101cd634df7afe108a63419a864c77098c490608934c642b9d6eabc946ec1
MD5 7b94215e08e3e76de6c562256bbc9464
BLAKE2b-256 6b3d972e2207d5845b6129f553376010b0bddecc2b1b74799e186d97e0f326d6

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.11-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fc730367f4b2f7067c6f79269097d00eda969ea044c6d123db0769abca306638
MD5 1658e1e74eb3600ea52e10345d71033c
BLAKE2b-256 505a61e8e9f8616427cf29310da628d5e5a836892c6a0503a08fee3439140285

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.11-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 4bb9675435dbe1291989f8d3b33b80421e6ac7da819fe362fa82eab5519a16e2
MD5 84ae108e42e4e38923985c14014c2e0e
BLAKE2b-256 d44bfa724ded65584cff1b024016783614393c770a3b8ff9e0b2b2352153f955

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e8aad25facf737ce70669e6bf16056426ae0f786721f272077ee6fbc2dfdff1c
MD5 66a1117d5bd8ab98fea123f2cf1b038e
BLAKE2b-256 6889bcd63cb7bee31fffe526bdd31f4a65abe40beacba894a7f208ed10ee9576

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 054242d85e7c7ed0c65d8de94aebb869c0a29b0b1719bfbc4f321088159e5255
MD5 1e3bb1e2104391eab2e48540a9cf1f84
BLAKE2b-256 2b9ecd246386d325c37e78508cd92d7766b379ed34591189c578864e623d3839

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.11-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a6bde2fef5e06e6d3579bae9273dde166e068abd67616c76b96be10cd70ef9e9
MD5 518649a2e5866498f1a068259cf10ce8
BLAKE2b-256 42e14404622c488a86fa255578ffa6366db26b008e127c917003fb5cc1c0ba5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 02228e385e8ae35d520f9de8872063f88a1faf475e396a3363617b83a2fb51d3
MD5 df167b21a6ccd387292011da084c2069
BLAKE2b-256 85a6300133dfa4f0b33276763fbdd94550829e33401ecc2893cb3b3aca5cf7e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 bcb310b9fa23e869f0662d0ceaeed3497eaccaa8165b2d60a37d1484069c2e7e
MD5 21e64991ff5c7d3988fbfa174b70612c
BLAKE2b-256 67b41a869fe63d296073c6d71f825cc4a84584348fe93a2bb1afb405139ce531

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 32a318f41f0910579a85aeadf2810c815f41e33d06d5abba3d9c3b475838b5cc
MD5 e7cc453d7cb150966aa924edfdd693a3
BLAKE2b-256 1a66c134db3ed52a1c968d755620145381379478c7a4c451f0d3e58e898454a4

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.11-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e66ecde93fa2ec3362c0d80aacc2270ad4b5882d4835444bff34223f6d6f5f51
MD5 2530841f655d2375c66727ba5b43f8c3
BLAKE2b-256 c0b0b768a59be46f633f1ada3f818de630c73265867dc8b0ff2a1e6dc2b80ffc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 aad31c623cfe122cac223a7e603fc30ba6b8a56436d0a986fb1f60045c635e0c
MD5 c37e5dadcf817da234f2b9c61af203d2
BLAKE2b-256 5d467b82ededbd6f5b1b1383053f88df5ffd16c66ed0623a8e778787458569bb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pygeodesic-0.1.11-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pygeodesic-0.1.11-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6c8fc3a92087e9757e0c4f7ebf8dd47cb031367bbf48c0277392c852b4b6e609
MD5 3dd7220271fdfc3dcd46d7f051f2cb61
BLAKE2b-256 5abcaa653f5c817213698e75be0006cd426dcebc29714685810b21bbafde2410

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4f46c00dd763ff6bebae6c5fc2437b115bd59d0a0b4f9d0158f36389680f1f1a
MD5 52e2b733cf42a16e515bd08e87f54d94
BLAKE2b-256 0d918d037492bd6fc47edaac97a8bea86df8215a13c51063cdf3c3dd8ddc7373

See more details on using hashes here.

File details

Details for the file pygeodesic-0.1.11-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b98e74f6b22dce80c74ed1aa4fedc01ca1b13cd0b660fdeb2732a15cdaa28d6e
MD5 c5535567fbc7d389b1789c8443d52284
BLAKE2b-256 5663c3ad7b8aca07942a9d6726145ce9838a5c27b22c5aaa99d554c5749bd330

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygeodesic-0.1.11-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 22606383c2de4d23c684508a23275e785759b34f78ea9b60222fe520277ab820
MD5 3d5f4641662b292a805a69bb7bf3e29c
BLAKE2b-256 cdeb8c8097db37f26883d0cad27eb6b8ddf1fbc1c71767a5da55b4086325822e

See more details on using hashes here.

Supported by

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