Main Content

SegmentedRoadCurve

Define horizontal curve of segmented road

Since R2025a

    Description

    The SegmentedRoadCurve object represents the horizontal curve of a segmented road in a RoadRunner scene. The horizontal curve of a segmented road enables you to build a road curve by specifying separate segments of various curve types and joining them together, end to end.

    The horizontal curve of a segmented road in RoadRunner support these types of road segments:

    • Lines— Have a curvature of zero

    • Arcs— Have a constant curvature

    • Spirals— Have a blending curvature

    • Parametric Cubics— Consist of cubic tangents with control points

    For more information on the geometry of road curves in RoadRunner, see.

    Creation

    TOUCHING HERE To create a SegmentedRoadCurve object, extract the HorizontalCurve property of a segmented road, specified by a Road object, in your RoadRunner scene. For example, given the Road object, rrRoad, segmentedCurve= rrRoad.HorizontalCurve extracts the horizontal curve of the segmented road to get the SegmentedRoadCurve object segmentedCurve. You can add segments to a segmented road curve by using the addLine, addArc, addSpiral, and addParametricCubic functions.

    Object Functions

    addLineAdd new line segment to horizontal curve of segmented road
    addArcAdd new arc segment to horizontal curve of segmented road
    addSpiralAdd new spiral segment to horizontal curve of segmented road
    addParametricCubicAdd new parametric cubic segment to horizontal curve of segmented road

    Examples

    collapse all

    Create a roadrunner object, specifying the path to an existing project. For example, this code shows the path to a project, on a Windows® machine, located at "C:\RR\MyProject". This code assumes that RoadRunner is installed in the default location, and returns an object, rrApp, that provides functions for performing basic tasks such as opening, closing, and saving scenes and projects.

    rrApp = roadrunner(ProjectFolder="C:\RR\MyProject");

    Note

    If you are opening RoadRunner from MATLAB® for the first time, or if you have changed the RoadRunner installation location since you last opened it from MATLAB, you can use the roadrunnerSetup function to specify new default project and installation folders to use when opening RoadRunner. You can save these folders between MATLAB sessions by selecting the Across MATLAB sessions option from the corresponding drop down.

    Create a new scene in RoadRunner by using the newScene function, specifying the roadrunner object rrApp.

    newScene(rrApp)
    

    Create a RoadRunner authoring API object, rrAPI, that references the object for the current RoadRunner instance rrApp. The rrApi object enables you to programmatically author scenes, such as by adding and modifying road and lane components, using MATLAB.

    rrApi = roadrunnerAPI(rrApp);
    
    Extract the object for your scene from the Scene property of the authoring API object rrApi. The extracted Scene object enables you to specify the scene in which to add scene components, such as roads and lanes.
    scn = rrApi.Scene;

    Specify the control points of the starting point forward direction of a road as positions along the X- and the Y- axes of the RoadRunner local coordinate system. Then, use the addSegmentedRoad function to add a segmented curve type road to the scene.

    startPoint = [-100 0];
    startRoadDirection = [1 0];
    rrRoad = addSegmentedRoad(scn,startPoint,startRoadDirection);

    Extract the SegmentedRoadCurve object from the HorizontalCurve property of the road rrRoad. The extracted object enables you to add curved road segments such as lines, arcs, spirals, and parametric cubics to the horizontal curve of the road.

    segmentedCurve = rrRoad.HorizontalCurve;

    Version History

    Introduced in R2025a