diff --git a/+world/@Lanelet/findLaneletByPosition.m b/+world/@Lanelet/findLaneletByPosition.m index 24bd68e8b0b52a62ab8b7d4d91b2d0acefed6ac0..eaa80fda55faf4963606f6c3d18efa8729c06cb3 100644 --- a/+world/@Lanelet/findLaneletByPosition.m +++ b/+world/@Lanelet/findLaneletByPosition.m @@ -17,7 +17,7 @@ function [lanelets] = findLaneletByPosition(obj, position) % Author: Markus Koschi % Written: 23-December-2016 -% Last update: 31-August-2017 +% Last update: 06-September-2017 % % Last revision:--- @@ -28,7 +28,7 @@ lanelets = world.Lanelet.empty(); for i = 1:numel(obj) % 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)]; - 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); if in || on lanelets(end+1) = obj(i);