Skip to main content

geometry_adapt_nalgebra/
lib.rs

1//! Adapt `nalgebra` points and vectors to the `geometry-trait`
2//! concept surface.
3//!
4//! Mirrors the role of the Boost `BOOST_GEOMETRY_REGISTER_*` macros in
5//! `boost/geometry/geometries/adapted/` — those specialise the C++
6//! `traits::{tag, dimension, coordinate_type, coordinate_system,
7//! access}` metafunctions for a foreign storage layout. Rust has no
8//! specialisation and the orphan rule forbids implementing a foreign
9//! trait ([`geometry_trait::Point`]) for a foreign type
10//! (`nalgebra::Point2` et al.), so — as with
11//! [`geometry_adapt::Adapt`](https://docs.rs/geometry-adapt) — each
12//! foreign value is wrapped in a local `#[repr(transparent)]` newtype
13//! and the geometry concepts hang off the wrapper.
14//!
15//! Two domain nouns are adapted:
16//!
17//! * [`NaPoint2`] / [`NaPoint3`] — `nalgebra::Point2` / `Point3`.
18//! * [`NaVector2`] / [`NaVector3`] — `nalgebra::Vector2` / `Vector3`.
19//!
20//! Every wrapper pins `Cs = Cartesian`. `nalgebra` points and vectors
21//! are read-write, so each also implements
22//! [`geometry_trait::PointMut`].
23
24#![forbid(unsafe_code)]
25
26mod point;
27mod vector;
28
29pub use point::{NaPoint2, NaPoint3};
30pub use vector::{NaVector2, NaVector3};