
function r = circleb(f, R, parent)
    r = zeros(size(f));
    
    m00 = mom(f, R, parent, 0, 0);
    m01 = mom(f, R, parent, 0, 1);
    m10 = mom(f, R, parent, 1, 0);
    
    mx = m10 ./ m00;
    my = m01 ./ m00;
    
    [w, h] = size(f);
    
    for x = 1:numel(f)
        for y = 1:numel(f)
            if !child(f, R, parent, x, y)
                continue;
            end
            
            u = mod(y - 1, w) + 1;
            v = ceil(y / w);
            
            r(x) = max(r(x), sqrt((mx(x) - u) ^ 2 + (my(x) - v) ^ 2));
        end
    end
end
