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
//! Ploc is a library for efficient point location queries.
//!
//! It uses efficient data structures like trapezoidal maps,
//! as well as parallelism to make queries on many points as
//! fast as possible.
//!
//! # Basic usage
//!
//! A [`PointLocator`] trait is provided for any data structure that
//! can answer point location queries, the most simple one being one
//! that performs a linear search through the mesh to find the cells
//! that contain the query points. The main implementor provided by
//! Ploc is the trapezoidal map, or [`TrapMap`] for short.
//!
//! A trapezoidal map is constructed from a [`Mesh`] and then queried
//! as follows:
//!
//! ```
//! use ploc::{Mesh, PointLocator, TrapMap};
//!
//! // Create a `Mesh`
//! let (xmin, xmax) = (0., 2.);
//! let (ymin, ymax) = (0., 2.);
//! let mesh = Mesh::grid(xmin, xmax, ymin, ymax, 2, 2).unwrap();
//!
//! // Create a trapezoidal map
//! let trap_map = TrapMap::from_mesh(mesh);
//!
//! // Make a query
//! let query = vec![[0.5, 0.5], [1.5, 0.5], [0.5, 1.5], [1.5, 1.5]];
//! let locations = trap_map.locate_many(&query);
//! assert_eq!(locations, vec![Some(0), Some(1), Some(2), Some(3)]);
//! ```
// Ploc types in rustdoc of other crates get linked to here.
pub use ;
pub use PointLocator;
pub use RectilinearLocator;
pub use TrapMap;
pub use Point;