Skip to main content

ifc_alignment/vertical/
seam.rs

1//! Seams between consecutive vertical segments, and grade breaks.
2//!
3//! IFC4.3 ADD2 `IfcAlignmentVerticalSegment`: "The transition at the
4//! segment connection is not enforced to be tangential", and "Connectivity
5//! between vertical segments is not necessarily tangential". The schema has
6//! no attribute that would require it. Real exports carry such grade breaks
7//! as authored design (buildingSMART IFC4.x-IF `BC003_ALX2`: 47 constant
8//! grades meeting at 29 breaks with continuous height).
9//!
10//! So a seam whose height is continuous but whose grade changes is not an
11//! error. It is a fact about the profile, reported here as
12//! [`VerticalSeamKind::GradeBreak`]. A caller that needs a tangent profile
13//! asks for it explicitly with
14//! [`VerticalLayout::require_tangential`](super::VerticalLayout::require_tangential).
15
16use ifc_model::EntityId;
17
18/// How the grade continues across one vertical seam.
19#[non_exhaustive]
20#[derive(Debug, Clone, Copy, PartialEq, Eq)]
21pub enum VerticalSeamKind {
22    /// `StartGradient` equals the previous `EndGradient` up to rounding.
23    Tangential,
24    /// The grade changes at the seam: the profile has a kink there. Legal
25    /// IFC4.3, and carried exactly by the composed elevation law, whose
26    /// pieces each keep their own grade.
27    GradeBreak,
28}
29
30/// One seam between two consecutive vertical segments of positive length.
31#[derive(Debug, Clone, PartialEq)]
32#[non_exhaustive]
33pub struct VerticalSeam {
34    /// The segment that ends at this seam.
35    pub previous: EntityId,
36    /// The segment that starts at this seam.
37    pub next: EntityId,
38    /// `StartDistAlong` of `next`, in metres.
39    pub distance_along: f64,
40    /// The previous segment's `EndGradient`.
41    pub incoming_gradient: f64,
42    /// The next segment's `StartGradient`.
43    pub outgoing_gradient: f64,
44    /// Whether the grade continues or breaks.
45    pub kind: VerticalSeamKind,
46}