axiolid_linear/line.rs
1//! Unbounded parametric lines.
2
3use axiolid_core::{Point2, Point3, Vec2, Vec3};
4
5/// Infinite parametric line `origin + t * direction`.
6///
7/// The direction is deliberately not normalised on construction: import
8/// adapters preserve authored vectors, and normalising here would silently
9/// change the parameterisation a caller reasons about.
10#[derive(Debug, Clone, Copy, PartialEq)]
11#[cfg_attr(
12 feature = "serde",
13 derive(serde::Serialize, serde::Deserialize),
14 serde(deny_unknown_fields)
15)]
16pub struct Line<P, V> {
17 /// Point at parameter zero.
18 pub origin: P,
19 /// Parameter direction; import adapters may preserve a non-unit vector.
20 pub direction: V,
21}
22
23/// Two-dimensional line.
24pub type Line2 = Line<Point2, Vec2>;
25/// Three-dimensional line.
26pub type Line3 = Line<Point3, Vec3>;