addControlPoint
Description
adds a control point to the specified line-arc road curve at the specified position.controlPoint
= addControlPoint(roadCurve
,position
)
Examples
Use the addControlPoint
function to add control points to a line-arc road curve to modify its shape.
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);
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;
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 road 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;
Use addControlPoint
to Modify Line-Arc Road Curve
You can modify existing road curves by adding additional control points to them or
changing the positions of existing control points in the scene. To change the shape
and increase the total length of the line-arc curve lineArc
, use
the addControlPoint
function to add two new control points to the curve. Specify the positions of the
control points so that the curve extends smoothly 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. Then, to add lanes to the left and right
of the reference lane, use the addLaneToLeft
and
addLaneToRight
functions, respectively, specifying the
ReferenceLane
object.
roadRef = rrRoad.ReferenceLane; leftLane = addLaneToLeft(roadRef); rightLane = addLaneToRight(roadRef);
Input Arguments
Line-arc road curve to which to add a control point, specified as a LineArcRoadCurve
object.
Example: controlPoint = addControlPoint(lineArc,[200 50]);
adds a
control point to the line-arc road curve lineArc
at the position
[200 50]
.
Position at which to place the control point in the RoadRunner local coordinate system, specified as a two-element vector.
Output Arguments
Control point on a road curve, returned as a LineArcRoadCurvePoint
object.
Version History
Introduced in R2025a
See Also
roadrunnerAPI
| Scenario
(RoadRunner Scenario) | anchorToPoint
(RoadRunner Scenario) | Route
(RoadRunner Scenario) | RouteSegment
(RoadRunner Scenario)
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)