Check if query position is inside selected submap
Check If Positions Are in Selected Submap
Load a map of segments and features from a MAT file.
data = load('segmatchMapFullParkingLot.mat'); sMap = data.segmatchMapFullParkingLot;
Select a submap within the map.
center = [0 30 0]; sz = [40 24 10]; sMap = selectSubmap(sMap,center,sz);
Check three positions to see if they are inside the submap.
pos1 = [0 30 0]; % center [isInside1,distToEdge1] = isInsideSubmap(sMap,pos1)
isInside1 = logical 1
distToEdge1 = 1x3 single row vector 20.0000 12.0000 0.0649
pos2 = [60 0 0]; % completely outside [isInside2,distToEdge2] = isInsideSubmap(sMap,pos2)
isInside2 = logical 0
distToEdge2 = 1x3 single row vector 40.0000 18.0000 0.0649
pos3 = [15 30 0]; % inside, 5 meters from edge in x direction [isInside3,distToEdge3] = isInsideSubmap(sMap,pos3)
isInside3 = logical 1
distToEdge3 = 1x3 single row vector 5.0000 12.0000 0.0649
isInside — Indication of position inside submap
Indication of position inside submap, returned as a logical
distToEdge — Distance from the query position to closest edge of the submap
Distance from the query position to the closest edge of the submap in the X-, Y-, and Z-axes respectively, returned as a 3-element vector.