
function centroids = calcStageGridCentroids(stage_grid)
T = stage_grid.tri_info.T;
pts = stage_grid.tri_info.pts;
stage_ind = stage_grid.region_tri_ind;
centroids = [];
for r=1:length(stage_ind)
    rtri= T(stage_ind{r}, :);
    %figure(1); clf; hold on;
    %triplot(T, pts(:,1), pts(:,2));
    %triplot(rtri, pts(:,1), pts(:,2), 'c');
    rtri = unique(rtri(:));
    rpts = pts(rtri,:);
    centroids(r,:) = mean(rpts, 1);
end
return