Main Content

LineArcRoadCurve

Specify line-arc road curve in RoadRunner scene

Since R2025a

    Description

    The LineArcRoadCurve object represents a line-arc road curve as the control points used to define the road curve.

    Creation

    To return the LineArcRoadCurve object that represents the line-arc curve of a road in your RoadRunner scene, extract the HorizontalCurve property of the corresponding Road object. For example, given a Road object, rrRoad, at represents a line-arc road in your scene, roadCurve = rrRoad.HorizontalCurve extracts the LineArcRoadCurve object roadCurve from the road rrRoad.

    Properties

    expand all

    Control points of the line arc road curve, specified as a LineArcRoadCurvePoint object or array of LineArcRoadCurvePoint objects.

    Object Functions

    addControlPointAdd control point to line-arc road curve

    Examples

    collapse all

    Use the addLineArcRoad function to add a line-arc road to your RoadRunner scene. Then, use the addControlPoint function to modify the shape and position of the line-arc road curve.

    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 an object for the RoadRunner authoring API, rrApi, that references the object for the current RoadRunner instance rrApp. The rrApi object enables you to programmatically author scenes and scenarios, such as by adding and modifying roads, actors, and logic components, using MATLAB.

    rrApi = roadrunnerAPI(rrApp);
    
    Extract the scene and scenario objects from the Scene and Scenario properties of the authoring API object rrApi, respectively. The extracted Scene object enables you to specify the scene in which to add scene components such as roads and lanes. The extracted Scenario (RoadRunner Scenario) object enables you to specify the scenario in which to add scenario components such as actors and logic.
    scn = rrApi.Scene;
    scnro = rrApi.Scenario;
    Extract the object for your RoadRunner project from the Project property of the authoring API object rrApi. The extracted Project object enables you to specify the project folder for the current RoadRunner session from which to retrieve asset objects. You can use the asset objects to assign assets to roads in your scene, or to actors in your scenario.
    prj = rrApi.Project;

    To create a line-arc road, use the addLineArcRoad function and specify the scene in which to add the road as scn, and the xy-positions of the control points as [-100 0] and [100 0]. Then, extract the line-arc curve from the HorizontalCurve property of the road rrRoad.

    rrRoad = addLineArcRoad(scn,[-100 0; 100 0]);
    lineArc = rrRoad.HorizontalCurve;
    

    Use addControlPoint to Modify Line Arc Road Curve

    You can modify existing road curves by adding additional control points or by changing the positions of existing control points in the scene. Use addControlPoint to add two control points to the line-arc curve lineArc to increase the total length of the road and extend it in the positive y-direction.

    newPoint = addControlPoint(lineArc,[200 50]);
    newPoint2 = addControlPoint(lineArc,[200 200]);

    By default, roads do not have any lanes and RoadRunner displays only their reference lanes in the scene editor. To add lanes to the road rrRoad, first extract the reference lane object from the ReferenceLane property.

    roadRef = rrRoad.ReferenceLane;
    

    Use the addLaneToLeft and addLaneToRight functions to add lanes to the left and right of the reference lane, respectively.

    leftLane = addLaneToLeft(roadRef);
    rightLane = addLaneToRight(roadRef); 

    You can use LineArcRoadCurve objects to modify the shapes of roads in your scene. For more information on modifying road curves in RoadRunner, see the Road Plan Tool (RoadRunner).

    Version History

    Introduced in R2025a