1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! A high-performance spatial index for radius queries in D-dimensional Euclidean space.
//!
//! The core data structure is [`Sprk`], which combines KD-tree-like axis-aligned
//! partitioning with SIMD-vectorized leaf scans and lookup-table-based pruning.
//! For cases where the dimensionality is not known at compile time, [`DynSprk`]
//! provides the same functionality with a runtime dimension parameter.
//!
//! # Quick Start
//!
//! ```
//! use sprk::Sprk;
//!
//! let positions = vec![[0.0f32, 0.0], [1.0, 0.0], [0.0, 1.0], [5.0, 5.0]];
//! let tree: Sprk<2> = Sprk::new(&positions);
//!
//! let mut results: Vec<u32> = Vec::new();
//! tree.query_radius(&[0.5, 0.5], 1.5, &mut results);
//! assert_eq!(results.len(), 3); // indices 0, 1, 2
//! ```
//!
//! # Output Types
//!
//! The output type is controlled by the [`QueryOutput`] trait.
//! Use integer types (`u32`, `usize`) for index-only results, or [`IdDist`] for
//! (index, squared distance) pairs:
//!
//! ```
//! use sprk::{Sprk, IdDist};
//!
//! let tree: Sprk<2> = Sprk::new(&[[0.0f32, 0.0], [1.0, 0.0]]);
//! let mut pairs: Vec<IdDist<u32, f32>> = Vec::new();
//! tree.query_radius(&[0.0, 0.0], 2.0, &mut pairs);
//! for p in &pairs {
//! println!("index {}, squared distance {}", p.id, p.dist);
//! }
//! ```
pub
/// Result types and the [`QueryOutput`] trait that controls what `query_radius` produces.
pub
pub
pub
pub use DynSprk;
pub use ;
pub use ;
pub use Sprk;