Modelling terrains with Delaunay triangulation
Project description
startinpy
A library for modelling and processing 2.5D terrains using a (2D) Delaunay triangulation. The triangulation is computed in 2D, but the z-elevation of the vertices are kept.
The underlying code is written in Rust (so it's rather fast) and robust arithmetic is used (so it shouldn't crash). startinpy uses the startin Rust library and adds several utilities and functions, for instance NumPy support for input/output, exporting to several formats, and easy-of-use.
startinpy allows you to:
- insert incrementally points
- delete vertices (useful for simplification, interpolation, and other operations)
- interpolate with several methods: TIN, natural neighbours, IDW, Laplace, etc.
- use other useful terrain Python libraries that are also NumPy-based, eg laspy, rasterio, meshio
- output the TIN to several formats: OBJ, PLY, GeoJSON, and CityJSON
- store extra attributes with the vertices (the ones from LAS/LAZ)
Documentation
Installation
pip
To install the latest release: pip install startinpy
(watch out: this does not work with Linux currently, it installs an old version!)
If you want to compile it yourself
- install latest Rust
- install maturin
maturin build --releasecd ./target/wheels/pip install [name-wheel].whlwill install it to your local Python
Development
- install Rust (v1.39+)
- install maturin
maturin develop- move to another folder, and
import startinpyshouldn't return any error
Testing
To run the automated test suite:
- install the test requirements:
pip install -r tests/requirements.txt pytest
Examples
The folder ./demo contains a few examples.
import laspy
import numpy as np
import startinpy
las = laspy.read("../data/small.laz")
pts = np.vstack((las.x, las.y, las.z)).transpose()
dt = startinpy.DT()
dt.insert(pts)
# -- remove vertex #4
try:
dt.remove(4)
except Exception as e:
print(e)
print("# vertices:", dt.number_of_vertices())
print("# triangles:", dt.number_of_triangles())
# -- print the vertices forming the convex hull, in CCW-order
print("CH: ", dt.convex_hull())
# -- fetch all the incident triangles (CCW-ordered) to the vertex #235
vi = 235
one_random_pt = dt.points[vi]
print("one random point:", one_random_pt)
print(dt.incident_triangles_to_vertex(vi))
# -- interpolate at a location with the linear in TIN method
zhat = dt.interpolate({"method": "TIN"}, [[85718.5, 447211.6]])
print("result: ", zhat[0])
If you use this software, please cite this article
@article{Ledoux24,
author = {Ledoux, Hugo},
title = {{startinpy}: {A} {P}ython library for modelling and processing {2.5D} triangulated terrains},
journal = {Journal of Open Source Software},
year = {2024},
volume = {9},
number = {103},
pages = {7123},
doi = {10.21105/joss.07123}
}
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 Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file startinpy-0.12.2-cp313-none-win_amd64.whl.
File metadata
- Download URL: startinpy-0.12.2-cp313-none-win_amd64.whl
- Upload date:
- Size: 325.8 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f09ba3c50abbfb6ba42dcedd11726b542cbee656fd17bfd660e5fc29d83bdd03
|
|
| MD5 |
4ca718077ba710913dc3124268172f09
|
|
| BLAKE2b-256 |
383e506a576b870bb63b2c5771053b5ff5ab93f981229c86947f7acbc2ec75b4
|
File details
Details for the file startinpy-0.12.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: startinpy-0.12.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 499.2 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
094cf386dde54bad0c6263803a35df8210eed177f236141222bf246ab35ca437
|
|
| MD5 |
61e55ab00dfeb4222fe94a99a13c7bad
|
|
| BLAKE2b-256 |
ea8a1dd862ff9bb33c8f79c67597fbcf6caa7ca5a59f967b26f73121cddce3ef
|
File details
Details for the file startinpy-0.12.2-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: startinpy-0.12.2-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 371.3 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0375f3dd2a393604a7bc5541ffb78d6a46087877692f8e8909334d7a77215543
|
|
| MD5 |
1ee75d55d13b0045c91f8dace772f626
|
|
| BLAKE2b-256 |
1a777f42379d7afb94da9e15ca8b360d9ec8d0ca9366812eb045e868ed383ac2
|
File details
Details for the file startinpy-0.12.2-cp312-none-win_amd64.whl.
File metadata
- Download URL: startinpy-0.12.2-cp312-none-win_amd64.whl
- Upload date:
- Size: 325.8 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b30f7181120ba554629d91560d06882ddc0251870516618088f0aca02b7d449
|
|
| MD5 |
02fa8501c7721998828b44f13b1c9ab2
|
|
| BLAKE2b-256 |
d74a9f88678734da29b3a759befa5a57c9757590a316bc73bb802b288f1ecc85
|
File details
Details for the file startinpy-0.12.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: startinpy-0.12.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 499.2 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e44bfb6fc470829ed83127444440d01559a9261fa3c8e33a7cb1ca3448cc1e44
|
|
| MD5 |
2aef0f7de70d76763f93170b726b3e97
|
|
| BLAKE2b-256 |
3be5b86e01ecb7de1b765406b95a94fae90054692267d455f3d20aaf84045b56
|
File details
Details for the file startinpy-0.12.2-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: startinpy-0.12.2-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 371.3 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bce191f546f3aedae513b4d4482cf32cf02125153f0e573e599c2f7f8e4dcdb
|
|
| MD5 |
3b999fcbca7a8175a0510ad91c6697b7
|
|
| BLAKE2b-256 |
36925f29e0abca00316f550058022685bb5f68bddfe061b920ecdfa84739c344
|
File details
Details for the file startinpy-0.12.2-cp311-none-win_amd64.whl.
File metadata
- Download URL: startinpy-0.12.2-cp311-none-win_amd64.whl
- Upload date:
- Size: 325.6 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c838fea5d893f4af194364f5ab1468c5a8da685708b0e6766920f9b3a367307
|
|
| MD5 |
5f066310357136c77725be231b1f057f
|
|
| BLAKE2b-256 |
009f0da8b223c38cd01ef9a7e1738afdc79715a952b10a41193f707e6dd9391c
|
File details
Details for the file startinpy-0.12.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: startinpy-0.12.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 499.2 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef5cd734dbb37d60f78821cf5e84597591188cce422e9191459b90444b0da948
|
|
| MD5 |
0aeed42cada8a8237f16816665183078
|
|
| BLAKE2b-256 |
d7a00ef80c83e9922f0d5a600e00a8674be7c3b0cc1cb9d50fcb56190c3f1621
|
File details
Details for the file startinpy-0.12.2-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: startinpy-0.12.2-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 371.6 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
062e2daf6bbb16e7a12349ac4b96fa309c5d21adb9f912ece5b144ae8ffe5352
|
|
| MD5 |
7aeb830c6c4e04657c99de578ab5c752
|
|
| BLAKE2b-256 |
19f0fccc61587b053bfe3adc5ceeaf78280d07293dc56d1f9a4408389c790ba3
|
File details
Details for the file startinpy-0.12.2-cp310-none-win_amd64.whl.
File metadata
- Download URL: startinpy-0.12.2-cp310-none-win_amd64.whl
- Upload date:
- Size: 325.6 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f57ffbad84797049f8f8015f57fc81799b12120938bb30f174e48deca8be1d7d
|
|
| MD5 |
5021debff669afb4e3767552c41ce03c
|
|
| BLAKE2b-256 |
86106dfd88acd36a04bed41e364a8b57ddf3a0156f15d320d30a2673db287ddf
|
File details
Details for the file startinpy-0.12.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: startinpy-0.12.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 499.1 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c106df739fae315f6daba8df7bf1e4bc3732f0ea4743df225c418454e73b6fa
|
|
| MD5 |
31ffe967f9be6d8c3ea6a90bec54346c
|
|
| BLAKE2b-256 |
a6f0ba5f4de87dfae941dd54590bfb1dc9ce73b971082fe97b1ba17f81c76f39
|
File details
Details for the file startinpy-0.12.2-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: startinpy-0.12.2-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 371.6 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e400bf6b5bb3ac184f9bbda65c3ecb44fa07d2f7fa37f9255ca6bc7b971449bb
|
|
| MD5 |
56c9c87bd50fe0f3dea0c78f9d8d86ee
|
|
| BLAKE2b-256 |
9efdce24bae1cc33b61c5db7981738c3cbf4c29a5ede007a92610fc99bb8b92e
|