function h=sphere2plane(R,N)
% sphere2plane Plots a sphere or radius R on a plane in n segments.
% Usage:: h=sphere2plane(R[1],N[8]);
%

% revision history:
% 03/23/16 Mark D. Shattuck <mds> sphere2plane.m  
% 03/23/16 mds intial setup

%% Main
C=2*pi*R;  % Circumference of great circle

a=C/2;     % chord length of circular sector
h=C/2/N;   % height of circular sector

G=(a^2+4*h^2)/h/8;  % Radius of circular sector

th0=asin(a/2/G);    % half angle of circular sector

th=(-1:.01/N:1)*th0;

h=zeros(2,N);

clf;
hold on;
for n=1:N
  xoff=-C/2+C/N*(n-1)+C/2/N;
  h(:,n)=plot(xoff-G+C/2/N+G*cos(th),G*sin(th),'k',...
              xoff+G-C/2/N-G*cos(th),G*sin(th),'k');
end
axis('equal')