axiolid_profile/lib.rs
1#![forbid(unsafe_code)]
2
3//! Exact two-dimensional section profiles.
4//!
5//! The crate stores profile intent. Boolean cleanup and triangulation are
6//! algorithms in higher tiers so a consumer can use profile data without them.
7
8pub mod center_line;
9pub mod contour;
10pub mod parameterized;
11pub mod validate;
12
13use axiolid_core::Transform2;
14
15pub use center_line::CenterLineProfile;
16pub use contour::{Contour, ContourProfile, ProfileSegment};
17pub use parameterized::{CircleProfile, EllipseProfile, RectangleProfile, SectionProfile};
18pub use validate::ValidateProfile;
19
20/// Format-neutral profile representation.
21#[non_exhaustive]
22#[derive(Debug, Clone, PartialEq)]
23pub enum Profile {
24 /// Rectangle or rounded rectangle.
25 Rectangle(RectangleProfile),
26 /// Circle or annulus.
27 Circle(CircleProfile),
28 /// Ellipse.
29 Ellipse(EllipseProfile),
30 /// Structural parameterized section.
31 Section(SectionProfile),
32 /// Arbitrary exact contour with holes.
33 Contour(ContourProfile),
34 /// Profile transformed from another profile.
35 ///
36 /// Placement is recorded as a transform over the exact basis, not by
37 /// transforming tessellated points, so a placed circle stays a circle.
38 Derived {
39 /// Base profile.
40 basis: Box<Profile>,
41 /// Two-dimensional transform.
42 transform: Transform2,
43 },
44 /// Ordered collection of profiles used as one section.
45 Composite(Vec<Profile>),
46 /// Open path plus a constant width, centred on the path.
47 ///
48 /// Distinct from [`Profile::Contour`] because the area is *implied* by an
49 /// offset rather than bounded explicitly. A consumer that cannot offset
50 /// must refuse this rather than treat the path as a boundary: the path is
51 /// open, so reading it as a contour yields a degenerate zero-area region.
52 CenterLine(CenterLineProfile),
53}