%% Create Parking Lot Using Predefined Layout
% Explore the various parking lots that you can create by using predefined layouts as well as the options for configuring those layouts.
% Define the parking space used to populate the parking lot. Modify the width, length, or angle of the space and the width and strength of its lane markings. Plot the parking space.

width = 2.6; % m
length = 5.5; % m
angle = 90; % deg
markingWidth = 0.15;
markingStrength = 1;

space = parkingSpace(Width=width, ...
                    Length=length, ...
                    Angle=angle, ...
                    MarkingWidth=markingWidth, ...
                    MarkingStrength=markingStrength);
plot(space)

% Create a driving scenario containing a 50-by-50 meter parking lot. Specify a predefined parking lot layout and a minimum driving lane width. The generated parking lot fills with as many parking spaces that fit the layout as possible given the minimum driving lane width constraint. Modify the parking space, layout type, and driving lane width, and observe the effects on the parking lot. For example:
% As you increase the size of the parking space or the minimum driving lane width, the number of parking grids that fit in the middle of the parking lot decreases.
% If you select the HorizontalWithEdges or VerticalWithEdges layout, one edge has fewer spaces than the others. This edge contains a driving lane of width DrivingLaneWidth that enables vehicles to enter the parking lot.

scenario = drivingScenario;
vertices = [0 0; 50 0; 50 -50; 0 -50];
parkingLayout = "Vertical";
drivingLaneWidth = 2.6; % m

parkingLot(scenario,vertices, ...
    ParkingSpace=space, ...
    ParkingLayout=parkingLayout, ...
    DrivingLaneWidth=drivingLaneWidth);

plot(scenario)

% Copyright 2021 The MathWorks, Inc.