Main Content

grid2local

Convert grid indices to local coordinates

Description

xyLocal = grid2local(map,ijGrid) converts grid indices in the map to local coordinates.

example

Examples

collapse all

Create an empty occupancy map with a width and height of 10 meters.

map = occupancyMap(10,10);

Get local coordinates from grid indices.

[i,j] = meshgrid(1:5);
xyLocal = grid2local(map,[i(:) j(:)]);

Input Arguments

collapse all

Map representation, specified as a occupancyMap, mapLayer, multiLayerMap, or signedDistanceMap object.

Grid positions, specified as an n-by-2 matrix of [i j] pairs in [rows cols] format, where n is the number of grid positions. The grid cell locations are counted from the top left corner of the grid.

Data Types: double

Output Arguments

collapse all

Local coordinates, specified as an n-by-2 matrix of [x y] pairs, where n is the number of local coordinates.

Data Types: double

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2019b

expand all