Commit d5bb0b01 authored by Markus Koschi's avatar Markus Koschi

hotfix: bug in @Lanelet

parent 63e2754c
...@@ -17,7 +17,7 @@ function [lanelets] = findLaneletByPosition(obj, position) ...@@ -17,7 +17,7 @@ function [lanelets] = findLaneletByPosition(obj, position)
% Author: Markus Koschi % Author: Markus Koschi
% Written: 23-December-2016 % Written: 23-December-2016
% Last update: 31-August-2017 % Last update: 06-September-2017
% %
% Last revision:--- % Last revision:---
...@@ -28,7 +28,7 @@ lanelets = world.Lanelet.empty(); ...@@ -28,7 +28,7 @@ lanelets = world.Lanelet.empty();
for i = 1:numel(obj) for i = 1:numel(obj)
% call inpolygon to check whether the position is in or on lanelet(i) % call inpolygon to check whether the position is in or on lanelet(i)
xv = [obj(i).leftBorderVertices(1,:), fliplr(obj(i).rightBorderVertices(1,:)), obj(i).leftBorderVertices(1,1)]; xv = [obj(i).leftBorderVertices(1,:), fliplr(obj(i).rightBorderVertices(1,:)), obj(i).leftBorderVertices(1,1)];
yv = [obj(i).leftBorderVertices(2,:), fliplr(obj(i).rightBorderVertices(2,:)), obj(1).leftBorderVertices(2,1)]; yv = [obj(i).leftBorderVertices(2,:), fliplr(obj(i).rightBorderVertices(2,:)), obj(i).leftBorderVertices(2,1)];
[in, on] = inpolygon(position(1,:), position(2,:), xv, yv); [in, on] = inpolygon(position(1,:), position(2,:), xv, yv);
if in || on if in || on
lanelets(end+1) = obj(i); lanelets(end+1) = obj(i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment