code for resampling an sph snapshot