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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//! # Apollonius
//!
//! **Apollonius** is a lightweight, N-dimensional Euclidean geometry library for Rust. It provides
//! points, vectors, and geometric primitives (lines, segments, hyperspheres, hyperplanes, AABBs,
//! triangles) with a unified intersection API and spatial queries, all built with `const generics`
//! for type-safe 2D, 3D, or arbitrary dimension.
//!
//! ## Design goals
//!
//! * **Pure geometry** — No physics, no units; only shapes, distances, and intersections.
//! * **N-dimensional** — Same types and traits work in 2D, 3D, or N-D via `Point<T, N>` and
//! `Vector<T, N>`.
//! * **Minimal dependencies** — Core logic depends only on `num-traits`; optional `serde` for
//! serialization.
//!
//! ## Core types
//!
//! | Module | Types / traits |
//! |-------------|----------------|
//! | **Points** | [`Point`], [`Point2D`], [`Point3D`], [`MetricSquared`], [`EuclideanMetric`] |
//! | **Vectors** | [`Vector`], [`Vector2D`], [`Vector3D`], [`VectorMetricSquared`], [`EuclideanVector`] |
//! | **Matrices** | [`Matrix`]`<T, N, Tag>`, tags [`General`], [`Isometry`], [`Affine`]; traits [`MatrixTag`], [`IsAffine`], [`IsIsometry`]; [`AffineTransform`] |
//! | **Primitives** | [`Line`], [`Segment`], [`Hypersphere`] (Circle, Sphere), [`Hyperplane`], [`AABB`], [`Triangle`] |
//! | **Traits** | [`SpatialRelation`] (closest_point, distance_to_point, contains), [`Bounded`] (aabb) |
//! | **Results** | [`IntersectionResult`] (None, Tangent, Secant, Collinear, Single, HalfSpacePenetration) |
//! | **Utils** | [`classify_to_zero`], [`FloatSign`] for robust float comparison |
//!
//! For one-shot imports of the most used types, use [`prelude`].
//!
//! ## Quick example
//!
//! ```
//! use apollonius::{Point, Vector, Line, Hypersphere, IntersectionResult};
//!
//! let line = Line::new(Point::new([-5.0, 0.0]), Vector::new([1.0, 0.0]));
//! let sphere = Hypersphere::new(Point::new([0.0, 0.0]), 2.0);
//!
//! match line.intersect_hypersphere(&sphere) {
//! IntersectionResult::Secant(p1, p2) => { /* line pierces sphere at p1, p2 */ }
//! IntersectionResult::Tangent(p) => { /* line touches sphere at p */ }
//! _ => { /* no intersection */ }
//! }
//! ```
//!
//! ## Features
//!
//! * **`serde`** — Enables `Serialize` / `Deserialize` for points, vectors, and primitives.
//! Use with `apollonius = { version = "...", features = ["serde"] }`.
// -----------------------------------------------------------------------------
// Re-exports: algebra
// -----------------------------------------------------------------------------
pub use crate;
// -----------------------------------------------------------------------------
// Re-exports: primitives and space
// -----------------------------------------------------------------------------
pub use crate;
pub use crateAffineTransform;
pub use crate;
// -----------------------------------------------------------------------------
// Prelude
// -----------------------------------------------------------------------------
/// Prelude for convenient imports.
///
/// Use `use apollonius::prelude::*` to bring in the most common types and traits
/// in one go: points, vectors (and their metric traits), matrices (and their
/// tags/traits), primitives, and spatial traits. The metric traits
/// ([`EuclideanMetric`], [`MetricSquared`], [`EuclideanVector`], [`VectorMetricSquared`])
/// are required for distances, magnitudes, and related methods on [`Point`] and [`Vector`].