def resample_nd(curve, npoints, smooth = 0, periodic = False, derivative = 0):
"""Resample n points using n equidistant points along a curve
Arguments:
points (mxd array): coordinate of the reference points for the curve
npoints (int): number of resamples equidistant points
smooth (number): smoothness factor
periodic (bool): if True assumes the curve is a closed curve
Returns:
(nxd array): resampled equidistant points
"""
cinterp, u = splprep(curve.T, u = None, s = smooth, per = periodic);
if npoints is all:
npoints = curve.shape[0];
us = np.linspace(u.min(), u.max(), npoints)
curve = splev(us, cinterp, der = derivative);
return np.vstack(curve).T;
评论列表
文章目录