Expand description
§STRIPACK
Delaunay Triangulation on the Unit Sphere.
A safe Rust wrapper for the STRIPACK library, providing Delaunay triangulation of points distributed on the surface of a unit sphere.
§Overview
This crate provides algorithms for creating and manipulating Delaunay triangulations on spherical surfaces. A Delaunay triangulation maximizes the minimum angle of all triangles, making it optimal for interpolation and nearest-neighbor queries.
§Features
- Triangulation Construction: Build Delaunay triangulations from sets of points on the unit sphere
- Dynamic Operations: Add or remove nodes while maintaining the Delaunay property
- Triangle Mesh Extraction: Get triangle indices, neighbor information, and edge data
- Voronoi Diagrams: Generate Voronoi cells (dual of Delaunay triangulation)
- Point Location: Find which triangle contains a given point
- Nearest Neighbor Queries: Find the k-nearest nodes to any point or node
- Boundary Detection: Identify boundary nodes for hemispherical data sets
- Geometric Utilities: Circumcenters, spherical triangle areas, coordinate conversions
§Quick Start
use stripack::DelaunayTriangulation;
// Create triangulation from unit vectors
let x = vec![1.0, 0.0, 0.0, 0.0];
let y = vec![0.0, 1.0, 0.0, 0.0];
let z = vec![0.0, 0.0, 1.0, 1.0];
let triangulation = DelaunayTriangulation::new(x, y, z)?;
// Extract triangle mesh
let mesh = triangulation.triangle_mesh()?;
// Find nearest node to a point
let nearest = triangulation.nearest_node(&[1.0, 0.0, 0.0], 0)?;§Main Types
DelaunayTriangulation: The primary structure representing a triangulationMeshData: Triangle mesh with indices, neighbors, and positionsVoronoiCell: Circumcenter and radius information for Voronoi diagramsLocationInfo: Result of point location queriesNearestNode: Index and distance for nearest neighbor queries
§Safety
This crate provides a memory-safe wrapper around the STRIPACK Fortran library. All FFI calls are encapsulated and exposed through a safe, idiomatic Rust API.
§Coordinate Systems
Points must lie on the unit sphere (x² + y² + z² = 1). Helper functions are provided for converting between Cartesian and spherical coordinates.
§Performance
Expected O(N log N) time complexity for construction with randomly ordered nodes. Worst case O(N²) if nodes are ordered (e.g., by latitude).
§See Also
- STRIPACK Documentation
- stripack-sys: Low-level FFI bindings
Structs§
- Boundary
Info - The boundary nodes for a triangulation.
- Delaunay
Triangulation - A Delaunay triangulation on the unit sphere.
- Mesh
Data - The mesh data for the triangulation.
- Nearest
Node - Information about the nearest node
- Node
Deletion Info - The information related to the new triangulation created by deleting a node.
- Spherical
Coordinates - Coordinates on a sphere.
- Voronoi
Cell - Information about a Voronoi cell.
Enums§
- AddNode
Error - Circumcenter
Error - Delete
Node Error - Force
Adjacent Error - Inside
Error - Location
Info - Nearest
Node Error - Triangle
Mesh Error - Triangulation
Error - Voronoi
Cell Error
Functions§
- arc_
cosine - Computes the arc cosine with input truncated in the range
[-1, 1]. - areas
- Computes the areas of a spherical triangle on the unit sphere.
- cartesian_
coordinates - Transform spherical coordinates into Cartesian coordinates.
- circumcenter
- Returns the circumcenter of a spherical triangle.
- spherical_
coordinates - Converts from Cartesian to spherical coordinates (latitude, longitude, radius).