Main Content

addLineArcRoad

Add road with line-arc horizontal curve type to RoadRunner scene

Since R2025a

    Description

    rrRoad = addLineArcRoad(scn,controlPoints) creates a new road with a line-arc horizontal curve type and adds it to the specified RoadRunner scene, scn. The specified control points controlPoints control the shape of the line-arc curve type road at the time of road creation. To modify the shape of an existing line-arc curve type road, extract the HorizontalCurve property of the Road object and change the property value.

    example

    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;

    Use the addLineArcRoad function to add a new road with a line-arc horizontal curve type to the scene. Specify the position of the road by specifying the positions of its control points along the X- and Y- axes of the RoadRunner local coordinate system. Set the control points of the road to -100 and 50 on the X- axis and Y- axis, respectively.

    controlPoints = [-100 0; 0 50];
    rrRoad = addLineArcRoad(scn,controlPoints);

    Input Arguments

    collapse all

    Scene to which to add the road, specified as a Scene object.

    Example: rrRoad = addLineArcRoad(scn,controlPoints); adds a new road with a line-arc horizontal curve type, rrRoad, to the scene scn.

    XY- coordinates of the control points, specified as an N-by-2 numeric matrix where N is the number of control points. Each row of the matrix specifies the XY- coordinates of a control point. You can control the shape of the line-arc curve by clicking and dragging the control points.

    Output Arguments

    collapse all

    Road with line-arc horizontal curve type, returned as a Road object.

    Version History

    Introduced in R2025a