XYReconstruction barycentre algorithm first commit