Skip to main content

lower_vertical_segment

Function lower_vertical_segment 

Source
pub fn lower_vertical_segment(
    model: &Model,
    id: EntityId,
    units: AlignmentUnits,
) -> AlignmentResult<LoweredAlignmentCurve>
Expand description

Lower one IfcAlignmentVerticalSegment to an exact neutral curve in the (distance along, height) plane.

The segment goes through elevation_law, the same law the composed gradient curve uses, so the per-segment and composed paths accept, refuse and place exactly the same segments. The law is then written as a Curve2 whose parameter is plan distance from StartDistAlong, trimmed to 0..HorizontalLength:

  • degree 1 (CONSTANTGRADIENT): a line through (StartDistAlong, StartHeight) with direction (1, grade);
  • degree 2 (PARABOLICARC): a quadratic Bezier over the knot span 0..L with control points z0, z0 + g0 L / 2, z(L) at stations d0, d0 + L / 2, d0 + L. Equally spaced stations make the station linear in the parameter, so this is the IFC parabola exactly, not a fit.

A CIRCULARARC is the circle itself, Curve2::Circle, trimmed by angle from the start to where the plan distance HorizontalLength ends; its parameter is that angle, not plan distance.

§Errors

Fails if id is missing or malformed, and with everything elevation_law refuses: CLOTHOID (its curvature is not stated), and parameters that contradict their family. A zero-length segment (a layout’s closing segment) has no geometry to lower and is refused as AlignmentError::InvalidSegment.