Main Content

addBoundaries

Add lane boundaries to lane boundary segment object

Since R2024a

Description

example

lbsegmentUpdated = addBoundaries(lbsegment,boundaryIDs,boundaryPoints) adds lane boundaries with the specified boundary IDs boundaryIDs, and the boundary points relative to the specified boundary IDs boundaryPoints, to the laneBoundarySegment object lbsegment, and returns an updated laneBoundarySegment object, lbsegmentUpdated.

lbsegmentUpdated = addBoundaries(___,Name=Value) specifies options using one or more name-value arguments in addition to the input arguments from the previous syntax. For example, Index=1 adds a new lane boundary as the left-most boundary.

Note

This function requires the Scenario Builder for Automated Driving Toolbox™ support package. You can install the Scenario Builder for Automated Driving Toolbox support package from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

Examples

collapse all

Load lane boundary data into the workspace.

data = load("laneBoundarySegmentData.mat","lbsegment");

Display the loaded lane boundary segment object.

lbsegment = data.lbsegment
lbsegment = 
  laneBoundarySegment with properties:

       BoundaryIDs: [4×1 string]
    BoundaryPoints: {4×1 cell}
      BoundaryInfo: []
     NumBoundaries: 4
         NumPoints: 128
      GeoReference: []

Plot the lane boundary segment object.

plot(lbsegment)

Specify a boundary ID and boundary points for a new boundary.

boundaryID = "10";
boundaryPoints = {[-262 190 0; -140 120 0]};

Add the specified boundary points to the lane boundary segment object.

lbsegmentUpdated = addBoundaries(lbsegment,boundaryID,boundaryPoints)
lbsegmentUpdated = 
  laneBoundarySegment with properties:

       BoundaryIDs: [5×1 string]
    BoundaryPoints: {5×1 cell}
      BoundaryInfo: []
     NumBoundaries: 5
         NumPoints: 128
      GeoReference: []

Plot the updated lane boundary segment object.

plot(lbsegmentUpdated)

Input Arguments

collapse all

Lane boundary segment, specified as a laneBoundarySegment object.

Lane boundary IDs, specified as an N-by-1 string array. N is the number of lane boundaries.

Note

Each lane boundary ID value must be unique.

Data Types: string

Lane boundary points, specified as an N-by-1 cell array. N is the number of lane boundaries. Each cell contains a P-by-2 or P-by-3 matrix. P is the number of points for each lane boundary, and it must be greater than one.

  • If a matrix is a P-by-2 matrix, then each row represents the xy-coordinates of a lane boundary point. The z-coordinate of each lane boundary point is 0.

  • If a matrix is a P-by-3 matrix, then each row represents the xyz-coordinates of a lane boundary point.

Note

  • The x- or y-coordinate values of the lane boundary points stored in a matrix must increase or decrease monotonically.

  • Lane boundaries must be in left-to-right order with respect to the travel direction of the lane. For example, you must specify the left-most boundary and the right-most boundary in the first and last indices of the boundaryPoints argument, respectively.

Data Types: cell

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: lbsegmentUpdated = addBoundaries(lbsegment,boundaryID,boundaryPoints,Index=1) adds a new lane boundary with ID boundaryID and boundary points boundaryPoints as the left-most boundary of the input laneBoundarySegment object lbsegment, and returns an updated laneBoundarySegment object, lbsegmentUpdated.

Additional lane boundary information, specified as an N-by-1 structure array. N is the number of lane boundaries.

Data Types: struct

Index at which to insert the lane boundaries, specified as an N-element column vector of positive integers. N is the number of lane boundaries.

The lane boundary index counts in left-to-right order, with respect to the lane travel direction. For example, a one-way road with two lanes, which contains three lane boundaries, left-most lane boundary index is 1, the middle lane boundary index is 2, and the right-most lane boundary index is 3.

If you specify an index at which to insert a lane boundary, the function automatically indexes the existing lane boundaries and moves them incrementally to the right. Otherwise, the function appends all the new lane boundaries to the right side of the lane.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Output Arguments

collapse all

Updated lane boundary segment, returned as a laneBoundarySegment object.

The returned laneBoundarySegment object lbsegmentUpdated contains the lane boundaries added to the input laneBoundarySegment object lbsegment.

Version History

Introduced in R2024a