function myMap = MakeShadowMap(x_coord, y_coord, cheight, tmap)

[q,w] = size(tmap);
d = zeros(q,w);

%%%%%%%%%%%%%%%%%%%%%%%
% Find points higher than cell tower
%%%%%%%%%%%%%%%%%%%%%%

lossamount= -20;
for x= 1:q
    hy= 1;
    for y= 1:w
        if (tmap(x,y) > cheight)
            d(x,y)=1;
        end
    end
end

%%%%%%%%%%%%%%%%%%%%%%%
% Find points North of tower that are blocked by mountains
%%%%%%%%%%%%%%%%%%%%%%
for z= q:-1:y_coord
    imagesc(d)
    for v = 1:x_coord
        pointx = z;
        pointy = v;
            myang = atan2((pointx-y_coord),(pointy-x_coord));
            if ((myang == 180) | (myang==-180))
                continue;
            end
            y = x_coord;
            for x= y_coord+1:1:pointx
                while ( atan2((x-y_coord),(y-x_coord)) < myang)
                    y = y-1;
                end
                if (d(x,y)==1)  %mountain along path
                    d(pointx,pointy)= lossamount;
                    break
                end
            end 
    end
end

%%%%%%%%%%%%%%%%%%%%%%%
% Find points South of tower that are blocked by mountains
%%%%%%%%%%%%%%%%%%%%%%
for z= 1:y_coord-1
    for v = 1:x_coord
        pointx = z;
        pointy = v; 
        myang = atan2((pointx-y_coord),(pointy-x_coord));
        y = x_coord;
        for x= y_coord-1:-1:pointx
            while (atan2((x-y_coord), (y-x_coord)) >myang)
                 y = y-1;
            end
            if(d(x,y)==1)
                 d(pointx,pointy) = lossamount;
                 break
            end
        end
    end
end

myMap = d;
