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
//! # Fornjot Math Library
//!
//! [Fornjot] is an early-stage b-rep CAD kernel written in Rust. The kernel is
//! split into multiple libraries that can be used semi-independently, and this
//! is one of those.
//!
//! This library provides basic math types for Fornjot. It is built on
//! [nalgebra] and [Parry], but provides an interface that is specifically
//! tailored to the needs of Fornjot.
//!
//!
//! ## Failing [`From`]/[`Into`] implementations
//!
//! Please note that any [`From`]/[`Into`] implementation that convert floating
//! point numbers into [`Scalar`] can panic. These conversions call
//! [`Scalar::from_f64`] internally and panic under the same conditions. This
//! affects [`Scalar`] itself, but also any other types in this crate that
//! provide conversions from types that involve `f64`.
//!
//! This explicitly goes against the mandate of [`From`]/[`Into`], whose
//! documentation states that implementations must not fail. This is a
//! deliberate design decision. The intended use case of `Scalar` is math code
//! that considers NaN results a bug, not a recoverable error.
//!
//! For this use case, having easy conversions available is an advantage, and
//! explicit `unwrap`/`expect` calls would add nothing. In addition, the
//! [`From`]/[`Into`] documentation fails to provide any reasons for its
//! mandate.
//!
//! [Fornjot]: https://www.fornjot.app/
//! [nalgebra]: https://nalgebra.org/
//! [Parry]: https://www.parry.rs/

mod aabb;
mod arc;
mod circle;
mod coordinates;
mod line;
mod plane;
mod point;
mod poly_chain;
mod scalar;
mod segment;
mod transform;
mod triangle;
mod vector;

pub use self::{
    aabb::Aabb,
    arc::Arc,
    circle::Circle,
    coordinates::{Uv, Xyz, T},
    line::Line,
    plane::Plane,
    point::Point,
    poly_chain::PolyChain,
    scalar::{Scalar, Sign},
    segment::Segment,
    transform::Transform,
    triangle::{Triangle, Winding},
    vector::Vector,
};