Cython implementation of piecewise warp