Contenido principal

LineArcRoadCurvePoint

Specify control point on line-arc road curve in RoadRunner scene

Since R2025a

    Description

    The LineArcRoadCurvePoint object represents a control point on a line-arc road curve in the RoadRunner scene.

    Creation

    To return a LineArcRoadCurvePoint object for a control point in your RoadRunner scene, extract it from the ControlPoints property of the LineArcRoadCurve object that represents the corresponding line-arc road curve. For example, lineArcPoint = lineArc.ControlPoints(1) extracts the first control point from the line-arc road curve lineArc.

    When you use the addControlPoint function to add a control point to a specified road curve at a specified position, the function adds that control point as a LineArcRoadCurvePoint object to the ControlPoints property of the specified line-arc road curve.

    Properties

    expand all

    Position of the control point in the RoadRunner local coordinate system, specified as a two-element vector.

    Maximum radius, in meters, of the control point arc, specified as a numeric scalar.

    Amount of curvature blending before and after the arc of the control point, specified as a numeric scalar in the range [0,1]. RoadRunner uses spiral curves before and after the arc of the control point to calculate the curvature blending.

    Examples

    collapse all

    Add a line-arc road to a scene, then extract objects for the control points 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 and the xy-positions of the control points. Then, extract the line-arc curve from the HorizontalCurve property of the road rrRoad.

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

    Extract LineArcRoadCurvePoint Objects

    To extract LineArcRoadCurvePoint objects for the first and second control points of the line-arc curve lineArc, specify the first and second elements from the ControlPoints property of lineArc.

    arcPoint1 = lineArc.ControlPoints(1)
    arcPoint2 = lineArc.ControlPoints(2)

    You can use the LineArcRoadCurvePoint objects to modify the properties of the road curve control points. By modifying the control point properties, you can change the shape and position of the road in your RoadRunner scene.

    To move the road rrRoad in the scene, change the values of the Positions properties of the line-arc road curve points arcPoint1 and arcPoint2.

    arcPoint1.Position = [-100 -50];
    arcPoint2.Position = [100 50];

    Version History

    Introduced in R2025a