Skip to main content

Modelling terrains with Delaunay triangulation

Project description

PyPI docs GitHub license

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:

  1. insert incrementally points
  2. delete vertices (useful for simplification, interpolation, and other operations)
  3. interpolate with several methods: TIN, natural neighbours, IDW, Laplace, etc.
  4. use other useful terrain Python libraries that are also NumPy-based, eg laspy, rasterio, meshio
  5. output the TIN to several formats: OBJ, PLY, GeoJSON, and CityJSON
  6. store extra attributes with the vertices (the ones from LAS/LAZ)

Documentation

https://startinpy.rtfd.io

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

  1. install latest Rust
  2. install maturin
  3. maturin build --release
  4. cd ./target/wheels/
  5. pip install [name-wheel].whl will install it to your local Python

Development

  1. install Rust (v1.39+)
  2. install maturin
  3. maturin develop
  4. move to another folder, and import startinpy shouldn't return any error

Testing

To run the automated test suite:

  1. install the test requirements: pip install -r tests/requirements.txt
  2. 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])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

startinpy-0.12.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (504.4 kB view details)

Uploaded CPython 3.13 manylinux: glibc 2.17+ x86-64

startinpy-0.12.0-cp312-none-win_amd64.whl (333.2 kB view details)

Uploaded CPython 3.12 Windows x86-64

startinpy-0.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (504.4 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

startinpy-0.12.0-cp312-cp312-macosx_11_0_arm64.whl (380.0 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

startinpy-0.12.0-cp311-none-win_amd64.whl (332.4 kB view details)

Uploaded CPython 3.11 Windows x86-64

startinpy-0.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (504.4 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

startinpy-0.12.0-cp311-cp311-macosx_11_0_arm64.whl (380.0 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

startinpy-0.12.0-cp310-none-win_amd64.whl (332.4 kB view details)

Uploaded CPython 3.10 Windows x86-64

startinpy-0.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (504.4 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

startinpy-0.12.0-cp310-cp310-macosx_11_0_arm64.whl (380.0 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

File details

Details for the file startinpy-0.12.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for startinpy-0.12.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 99fd774a447047285c870d786af750421bbcacc408bea8389f3fb438a3b175c6
MD5 d0a6bb9350837f0fab4cf46ed83f0a8f
BLAKE2b-256 cc8abd718c6547aa4d140e974bb34d02538ca0187ac20ccc2840ba66694d70b1

See more details on using hashes here.

File details

Details for the file startinpy-0.12.0-cp312-none-win_amd64.whl.

File metadata

File hashes

Hashes for startinpy-0.12.0-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 8f92884ee9810991c535f658af09ad3165bb780c7d2d89875f04c298ed7ecda0
MD5 2c161e863fdbc5f55f555eeb37445fbb
BLAKE2b-256 c57e362d92ae372ab0e70798bb8df78f44e2729dfcb6968fc687f908c6652bf6

See more details on using hashes here.

File details

Details for the file startinpy-0.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for startinpy-0.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 720171f2342cd706943dfd5bfe83afa839823582c91db1aade036b24b81aa185
MD5 1101337c51a3d6094db791e307564877
BLAKE2b-256 aba130f529e93f9d278761cc8dc2397519c967e39eb4d32dc53a3bf7715ffba5

See more details on using hashes here.

File details

Details for the file startinpy-0.12.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for startinpy-0.12.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 19a2a746d6cae02bd4514298c90d3c290c2a9936029cfba4da9d2292b338473a
MD5 539d600514754bdef9f739ba9cebef2d
BLAKE2b-256 f18ee8d55020d8bcca2414aac06ee1f8856b62503269c3165fb740225d7c319b

See more details on using hashes here.

File details

Details for the file startinpy-0.12.0-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for startinpy-0.12.0-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 af5e01795bc2c8370899697a757e2041f41427a09c5a2a9e129a01bf813a117a
MD5 3f2daf8aea9312da392e2d72b353ca47
BLAKE2b-256 3fd294bbaff7915974ffcc76e3d99012cfa6bf234e6b83316dde547d40a884e8

See more details on using hashes here.

File details

Details for the file startinpy-0.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for startinpy-0.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2e31a32e887350b6a0c74619c958c73fc3c9e0b55aa26e3009412f3300c223a4
MD5 1b12c6679fe950ff6b322d2169278f12
BLAKE2b-256 23730c681c36b22a01a1da4092b5264da43e3e15ee9959f0a5765a70c2eae8ae

See more details on using hashes here.

File details

Details for the file startinpy-0.12.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for startinpy-0.12.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6927ab6fdc0165620324b94383d97689d166e93f6a375087ee692e597373301c
MD5 74d771afe519d4b53df8139ef0469ae1
BLAKE2b-256 542c2a33345289f88f6c265bdf7e1a3f69a45b05e06d21198f3d3353694150a7

See more details on using hashes here.

File details

Details for the file startinpy-0.12.0-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for startinpy-0.12.0-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 e16d3adb4ad8538ff5f9c2ee0059093cb8bb7bb912eb450500a3419af349f6f9
MD5 d472c30507b3db8d9d54afe2c7ce144e
BLAKE2b-256 40c77d10f4eb8296cc84add062a89931305845d6b3e6eee01068d4561abc7a4f

See more details on using hashes here.

File details

Details for the file startinpy-0.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for startinpy-0.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 23cb6cb09e67ba587205c55675cdbedabed22e2f8e77a92e012fb8896bdb9152
MD5 bd6b96a2017899f7c8ceea1343de8cd5
BLAKE2b-256 9f8b1ff4a1c1f089b7600d876277286bc492ddd21be431e1ad8ee89e45af8b30

See more details on using hashes here.

File details

Details for the file startinpy-0.12.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for startinpy-0.12.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b25157ebee0a06a6ce615edfe2e3df780df87f5102af5bad2e84b3b1e4147d1e
MD5 e685f1c993eb32a762436a4d1df0dee4
BLAKE2b-256 0d9a40b52e2f628309810c2f871506e24929b52c1cdca8dca6400c1ece86fc21

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