%% Create Parking Lot Containing Grid at Specific Position and Orientation
% Create a driving scenario containing a 50-meter road and a 20-by-30 meter parking lot. Plot the scenario.

scenario = drivingScenario;
roadcenters = [0 50; 50 0];
road(scenario,roadcenters);

vertices = [40 10; 25 -5; 5 15; 20 30];
lot = parkingLot(scenario,vertices);
plot(scenario)

%
% Insert a parking grid into the lot. Specify a grid with two rows of eight spaces. Use the default parking space dimensions, and place the grid at a 45-degree angle to align it with the road.

space = parkingSpace;
numSpaces = 8;
insertParkingSpaces(lot,space,numSpaces,Rows=2,Position=[15 20],Orientation=45)

% Copyright 2021 The MathWorks, Inc.