function [xp,yp,zp] = mapc2p(xc,yc,zc)
%
% Mapping for Figure 5.2(b) as described in Section 5.2 of
%    Logically Rectangular Grids and Finite Volume Methods for PDEs
%         in Circular and Spherical Domains,
%    by Donna A. Calhoun, Christiane Helzel, and Randall J. LeVeque,
%    http://www.amath.washington.edu/~rjl/pubs/circles

r1 = 1; % radius of ball
d = max(max(abs(xc),abs(yc)),abs(zc));
r = max(sqrt(xc.^2 + yc.^2 + zc.^2), 1e-10);
xp = r1 * d .* xc./r;
yp = r1 * d .* yc./r;
zp = r1 * d .* zc./r;

