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
//! `clearpath` — deterministic 2D obstacle-avoidance path planning and smooth spline fitting.
//!
//! See `docs/SPEC.md` for the normative specification this crate implements.
//!
//! The crate is `#![no_std]` and needs only `alloc`. Enable the default `std` feature for the
//! ergonomic `std`-backed build; build with `--no-default-features` for bare-metal targets.
//!
//! # Example
//!
//! ```
//! use clearpath::{BoundingBox, Point2D, Polygon};
//!
//! // A 2x2 square obstacle.
//! let obstacle = Polygon::new(vec![
//! Point2D::new(4.0, 4.0),
//! Point2D::new(6.0, 4.0),
//! Point2D::new(6.0, 6.0),
//! Point2D::new(4.0, 6.0),
//! ]).unwrap();
//!
//! assert!(obstacle.contains(Point2D::new(5.0, 5.0)));
//! assert!(!obstacle.contains(Point2D::new(7.0, 5.0)));
//! assert_eq!(obstacle.bounds(), BoundingBox::new(Point2D::new(4.0, 4.0), Point2D::new(6.0, 6.0)));
//! ```
extern crate alloc;
extern crate std;
pub use ;
pub use ;
pub use Clearance;
pub use ;
pub use ;
pub use CubicBezierSegment;
/// `sqrt` without `std`.
///
/// `f64::sqrt` exists in `core`, but routing it through `libm` unconditionally keeps one numeric
/// path rather than two that could differ between builds. The angular functions the orthogonal
/// router will need (`sin`, `cos`, `atan2`) are added with it, for the same reason.
pub