Auto-Grade Road

Procedurally drapes and slope-constrains a 2D centerline into a smooth 3D road profile.

Masterplan Nickname: AutoGrade

Overview

Procedurally drapes and slope-constrains a 2D centerline into a smooth 3D road profile.

Inputs (5)

  • Centerline (Curve): Flat 2D Centerline
  • Terrain (Mesh): Existing Ground Mesh
  • Max Slope (Number): Maximum longitudinal slope (e.g. 0.08 for 8%)
  • Resolution (Number): Subdivision distance in meters
  • Smoothing (Integer): Smoothing iterations for vertical curvature

Outputs (3)

  • 3D Road (Curve): The optimized, slope-constrained 3D centerline
  • Existing Ground (Curve): The raw draped profile on the terrain
  • Info (Text): Method, assumptions, simplifications and references.

Method, assumptions and simplifications

The same notes appear in the component's Info output.

Method

  1. The Centerline is divided into equal-length steps of about Resolution (number of steps = floor(length / Resolution), minimum 2).
  2. Each division point is draped onto the Terrain by a vertical ray cast down from 10 000 m above it; the first hit gives the existing ground level (EG). Points off the mesh keep the Z of the centerline.
  3. A forward pass then a backward pass clamp each level so the rise or fall to the previous (then next) point is at most Max Slope × horizontal distance. This gives the profile closest to EG that respects the grade limit.
  4. The profile is smoothed by Smoothing passes of a moving average over ±(steps / 20) neighbours (minimum ±1), with the first and last levels pinned after every pass. A forward and a backward pass then clamp the interior levels again to Max Slope (end levels stay pinned), so the point profile never exceeds Max Slope; smoothing alone could steepen the steps next to the ends.
  5. 3D Road is a degree-3 curve interpolated through the smoothed levels (polyline if that fails); Existing Ground is a polyline through the draped levels.
  6. The HUD reports the maximum grade of the smoothed point profile and the maximum cut and fill against EG at the division points.

Assumptions

  • Model units are metres; Max Slope is a ratio (0.08 = 8 %), default 0.08; Resolution default 2 m; Smoothing default 5. Resolution must be positive and Max Slope zero or positive, otherwise the component stops with an error.
  • The Terrain is a single surface seen from above (the topmost hit is used) and lies below Centerline Z + 10 000.
  • The road ends are meant to meet fixed levels, so the end levels are kept from the slope-clamped profile.

Simplifications and limits

  • Longitudinal profile only: no cross-fall, road width, earthwork volumes or batters.
  • No proper vertical curves (K values, sight distance): smoothing is a plain moving average.
  • Cut and fill are checked only at the division points, not along the interpolated curve, which can overshoot slightly between them.

Workflow

  • Road centerlines (for example from Road Network tools) and a terrain mesh (for example Site Fetch) -> Centerline and Terrain.
  • 3D Road -> sweep or loft a road section, or compare with Existing Ground to see cut and fill.