pub fn profile_law(
segments: &[VerticalSegment],
) -> AlignmentResult<ElevationLaw>Expand description
The whole vertical profile as one law over distance along the plan.
Segments are authored as a run, each with its own StartDistAlong, and
ElevationLaw::Piecewise wants interior seams plus one law per piece,
each written in its own distance restarting at zero. That is exactly how
elevation_law writes a segment, so no rebasing is needed here.
Every segment restates where it starts: StartDistAlong and
StartHeight must agree with where the previous segment ends (its
station plus HorizontalLength, and its law’s height there), or the
profile has a gap or a step at the seam. Joining it anyway would
silently shift every downstream height, so a step is refused with
AlignmentError::ProfileDiscontinuity (ProfileSeam::Height).
A change of grade at a seam whose height is continuous is accepted: a
grade break. IFC4.3 ADD2 (IfcAlignmentVerticalSegment): “The
transition at the segment connection is not enforced to be tangential”,
and the schema has no attribute that would demand it. The pieces of the
returned law are independent, so the break is carried exactly: each side
keeps its own authored grade, and both meet at one height. Ask
VerticalLayout::require_tangential
to demand tangency explicitly, and VerticalLayout::seams
to list the breaks.
The zero-length segment IFC4.3 requires at the end of a layout adds no
piece; its StartDistAlong and StartHeight are checked against the
profile’s end like any seam. A zero-length segment anywhere else, or as
the only segment, is refused (AlignmentError::SemanticViolation).
Seams are compared with SeamTolerance::strict: floating-point
rounding only. A file whose exporter rounds stations or heights states
that in its Precision; use profile_law_within with
SeamTolerance::for_model, or vertical_profile_law, to honour it.
§Errors
Refuses an empty profile, segments that are not sorted and contiguous, a height discontinuity at any seam, a misplaced zero-length segment, and any segment without an exact law.