function [prob atlas cseg] = init_chart(atlas, prob, cseg)
%INIT_CHART   Initialize chart.
%
% Initialize chart after initial correction and add to curve segment point
% list.

% This file is part of the atlas_kd toolbox, copyright (C) Michael
% Henderson, Frank Schilder, Harry Dankowicz, Erika Fotsch, of the package
% COCO (http://sourceforge.net/projects/cocotools).

chart         = cseg.curr_chart;
chart.pt      = atlas.next_pt;
atlas.next_pt = atlas.next_pt+1;
chart.id      = chart.pt+1;
chart.dim     = atlas.dim;
chart.s       = atlas.cont.s0;
chart.bv      = atlas.cont.bv0;
chart.P.mark  = zeros(1,numel(chart.bv));

[prob cseg]     = cseg.add_chart(prob, chart);
cseg.curr_chart = cseg.ptlist{1};

end
