function [ inter count] = circleInterior( Pc, r)
% This function finds all the interior points within the circle centered at
% "r" with radius "Pc"
% 
% Input:
%             Pc - center of the circle
%             r  - radius of the circle
% Output:
%          inter - interior points of the circle
%
% Copyright (c) 2017, Rujie Wang
% All rights reserved.
%
% IN NO CIRCUMSTANCES SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
% RESPONSIBLE FOR ANY PROBLEM, DAMAGE OR LOSS CAUSED.
%
% Redistribution of this code, with or without modification, are permitted 
% provided that the above copyright and disclaimer are retained.

    count = 0;
    inter = [];
    px = Pc(1); 
    py = Pc(2);

    for iy = (py+r) : -1 : (py-r) % traverse through pixels within the circumscribed square of the circle 
        for ix = (px-r) : 1 : (px+r)
            P = [ix, iy];
            dist = norm(P - Pc, 2); 
            if (dist <= r)
                inter = [inter; P];
                count = count + 1;
            end
        end
    end
    
    fprintf('--- Center: [%d %d] | Radius: %.2d | Points: %d\n',px ,py ,r ,count);
end

