{"id":20183164,"url":"https://github.com/hugoledoux/startin","last_synced_at":"2025-04-10T05:24:09.716Z","repository":{"id":43026607,"uuid":"167918307","full_name":"hugoledoux/startin","owner":"hugoledoux","description":"A Delaunay triangulator for processing TINs","archived":false,"fork":false,"pushed_at":"2024-04-23T14:36:01.000Z","size":501,"stargazers_count":29,"open_issues_count":7,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-02T21:27:53.430Z","etag":null,"topics":["delaunay","delaunay-triangulator","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hugoledoux.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-28T07:30:55.000Z","updated_at":"2024-05-29T11:13:59.148Z","dependencies_parsed_at":"2024-02-20T14:47:38.064Z","dependency_job_id":"a22586c6-46a0-4fd8-a771-e12acf8f38d2","html_url":"https://github.com/hugoledoux/startin","commit_stats":{"total_commits":339,"total_committers":6,"mean_commits":56.5,"dds":"0.020648967551622377","last_synced_commit":"00233b3a92b68853474aeeadaf97ad5cf0df87ef"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugoledoux%2Fstartin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugoledoux%2Fstartin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugoledoux%2Fstartin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugoledoux%2Fstartin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hugoledoux","download_url":"https://codeload.github.com/hugoledoux/startin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161751,"owners_count":21057643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["delaunay","delaunay-triangulator","rust"],"created_at":"2024-11-14T02:44:16.505Z","updated_at":"2025-04-10T05:24:09.682Z","avatar_url":"https://github.com/hugoledoux.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# startin\n\n[![crates.io](https://img.shields.io/crates/v/startin?color=%2355ab4e\u0026style=for-the-badge)](https://crates.io/crates/startin)\n[![docs.rs](https://img.shields.io/docsrs/startin?style=for-the-badge)](https://docs.rs/startin)\n[![PyPI](https://img.shields.io/pypi/v/startinpy?style=for-the-badge)](https://pypi.org/project/startinpy/)\n\nA Delaunay triangulator where the input are 2.5D points, the DT is computed in 2D but the elevation of the vertices are kept.\nThis is used mostly for the modelling of terrains.\nConstructing a 2D Delaunay triangulation is also possible.\n\nThe construction algorithm used is an incremental insertion based on flips, and the data structure is a cheap implementation of the star-based structure defined in [Blandford et al. (2003)](https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.9.6823), cheap because the link of each vertex is stored a simple array (`Vec`) and not in an optimised blob like they did.\nIt results in a pretty fast library (comparison will come at some point), but it uses more space than the optimised one.\n\nThe deletion of a vertex is also possible. The algorithm implemented is a modification of the one of [Mostafavi, Gold, and Dakowicz (2003)](https://doi.org/10.1016/S0098-3004(03)00017-7). \nThe ears are filled by flipping, so it's in theory more robust. \nI have also extended the algorithm to allow the deletion of vertices on the boundary of the convex hull. \nThe algorithm is sub-optimal, but in practice the number of neighbours of a given vertex in a DT is only 6, so it doesn't really matter.\n\nRobust arithmetic for the geometric predicates are used ([Shewchuk's predicates](https://www.cs.cmu.edu/~quake/robust.html), well the [Rust port of the code (robust crate)](https://crates.io/crates/robust)), so startin is robust and shouldn't crash (touch wood). \n\nThere are a few interpolation functions implemented: (1) nearest-neighbour, (2) linear in TIN, (3) Laplace, (4) natural neighbour (aka Sibson's interpolation), (5) IDW with search-radius.\n\n\n# Python bindings\n\nI also made Python bindings, called \"startinpy\": [https://github.com/hugoledoux/startinpy/](https://github.com/hugoledoux/startinpy/).\n\nThere are a few more functions (eg reading GeoTIFF, LAZ can be read easily), the docs is better, and it all input/output are NumPy arrays.\n\n\n# Web-demo with WebAssembly\n\nRust can be compiled to [WebAssembly](https://www.rust-lang.org/what/wasm), and you can see a demo of some of the possibilities of startin (all computations are done locally and it's fast!).\n\n[--\u003e web-demo](https://hugoledoux.github.io/startin_wasm/)\n\n\n# C interface\n\nA basic C interface is available in `src/c_interface.rs`, to compile it:\n\n```bash\ncargo build --features c_api\n```\n\n# Documentation\n\nYou can read the complete documentation [here](https://docs.rs/startin)\n\n# Usage\n\n```rust\nextern crate startin;\nfn main() {\n    let mut pts: Vec\u003c[f64; 3]\u003e = Vec::new();\n    pts.push([20.0, 30.0, 2.0]);\n    pts.push([120.0, 33.0, 12.5]);\n    pts.push([124.0, 222.0, 7.65]);\n    pts.push([20.0, 133.0, 21.0]);\n    pts.push([60.0, 60.0, 33.0]);\n    let mut dt = startin::Triangulation::new();\n    dt.insert(\u0026pts, startin::InsertionStrategy::AsIs);\n    println!(\"{}\", dt);\n    //-- print all the vertices\n    for (i, each) in dt.all_vertices().iter().enumerate() {\n        // skip the first one, the infinite vertex\n        if i \u003e 0 {\n            println!(\"#{}: ({:.3}, {:.3}, {:.3})\", i, each[0], each[1], each[2]);\n        }\n   }\n   //-- insert a new vertex\n   let re = dt.insert_one_pt(22.2, 33.3, 4.4);\n   match re {\n        Ok(_v) =\u003e println!(\n            \"Inserted new point, now the DT has {} vertices\",\n            dt.number_of_vertices()\n        ),\n        Err(v) =\u003e println!(\"Duplicate of vertex #{}, not inserted\", v),\n   }\n   //-- remove it\n   match dt.remove(6) {\n        Ok(num) =\u003e println!(\"Vertex deleted, now the DT has {} vertices\", num),\n        Err(why) =\u003e println!(\"!!! Deletion error: {:?}\", why),\n   }\n   //-- get the convex hull\n   let ch = dt.convex_hull();\n   println!(\"Convex hull: {:?}\", ch);\n   //-- fetch triangle containing (x, y)\n   match dt.locate(50.0, 50.0) {\n        Ok(tr) =\u003e println!(\"The triangle is {}\", tr),\n        Err(why) =\u003e println!(\"Error: {:?}\", why),\n   }\n   //-- interpolate with Laplace interpolation at 2 locations\n   let locs = vec![[51.0, 22.0], [50.3, 19.9]];\n   let interpolant = startin::interpolation::Laplace {};\n   let zs = startin::interpolation::interpolate(\u0026interpolant, \u0026mut dt, \u0026locs);\n   for z in \u0026zs {\n        match z {\n            Ok(value) =\u003e println!(\"z = {}\", value),\n            Err(why) =\u003e println!(\"Interplation impossible: {:?}\", why),\n        }\n   }\n   //-- save the triangulation in OBJ for debug purposes\n    let _re = dt.write_obj(\"/home/elvis/tr.obj\".to_string());\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugoledoux%2Fstartin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhugoledoux%2Fstartin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugoledoux%2Fstartin/lists"}