function [] = obstacleMap(obstacle,depth,azRange,altRange,range)
%PLOTTING FUNCTION TO PROJECT ALL OBSTACLE POINTS ON THE XY PLANE
%INPUTS:
%   Obstacle - binary image with 1s corresponding to obstacle pixel of the
%               depth map
%   depth - depth map
%   azRange - azimuthal range of the chopped image
%   altRange - altitude range of the chopped image
%   range - depth range to be plotted


[H,W] = size(depth);
azRange = azRange.*pi./180;
altRange = altRange.*pi./180;
[az, ~] = meshgrid(linspace(azRange(1), azRange(2), W), linspace(altRange(1), altRange(2), H));
theta = [];
r = [];
for jj = 1:W
    for ii = 1:H
        if obstacle(ii,jj) && (depth(ii,jj)<=range) && (depth(ii,jj)~=0)

            theta(end+1) = az(ii,jj);
            r(end+1) = depth(ii,jj);
        end
    end        
end

polar(theta,r,'.')
end