%% Plot Path of Ego Vehicle
% Create a 3-meter-wide lane.

lb = parabolicLaneBoundary([-0.001,0.01,1.5]);
rb = parabolicLaneBoundary([-0.001,0.01,-1.5]);

%
% Compute the lane boundary model manually from 0 to 30 meters along the x-axis.

xWorld = (0:30)';
yLeft = computeBoundaryModel(lb,xWorld);
yRight = computeBoundaryModel(rb,xWorld);

%
% Create a bird's-eye plot and lane boundary plotter. Display the lane information on the bird's-eye plot.

bep = birdsEyePlot('XLimits',[0 30],'YLimits',[-5 5]);
lanePlotter = laneBoundaryPlotter(bep,'DisplayName','Lane boundaries');
plotLaneBoundary(lanePlotter,{[xWorld,yLeft],[xWorld,yRight]});

%
% Create a path plotter. Create and display the path of an ego vehicle that travels through the center of the lane.

yCenter = (yLeft + yRight)/2;
egoPathPlotter = pathPlotter(bep,'DisplayName','Ego vehicle path');
plotPath(egoPathPlotter,{[xWorld,yCenter]});

% Copyright 2012 The MathWorks, Inc.