axiolid_linear/
polyline.rs

1//! Piecewise-linear curves.
2
3use axiolid_core::{Point2, Point3};
4
5/// Piecewise-linear curve preserving source vertex order.
6///
7/// Its native parameter is one unit per segment, not arc length and not a
8/// normalised `(0, 1)`: an open n-point polyline spans `(0, n - 1)` and a
9/// closed one `(0, n)`. A trim or profile-segment domain of `(0, 1)` on a
10/// multi-segment polyline therefore selects only its first edge; the scalar
11/// flattener in `axiolid-evaluate` refuses that rather than silently dropping
12/// the remaining vertices.
13#[derive(Debug, Clone, Default, PartialEq)]
14pub struct Polyline<P> {
15    /// Ordered control points.
16    pub points: Vec<P>,
17    /// Whether the final point connects back to the first.
18    pub closed: bool,
19}
20
21/// Two-dimensional polyline.
22pub type Polyline2 = Polyline<Point2>;
23/// Three-dimensional polyline.
24pub type Polyline3 = Polyline<Point3>;