[xs, ys] = adresamp2 (x, y, n, eps) ¶Perform an adaptive resampling of a planar curve. The arrays x and y specify x and y coordinates of the points of the curve. On return, the same curve is approximated by xs, ys that have length n and the angles between successive segments are approximately equal.
The following code
R = 2; r = 3; d = 1.5;
th = linspace (0, 2*pi, 1000);
x = (R-r) * cos (th) + d*sin ((R-r)/r * th);
y = (R-r) * sin (th) + d*cos ((R-r)/r * th);
x += 0.3*exp (-(th-0.8*pi).^2);
y += 0.4*exp (-(th-0.9*pi).^2);
[xs, ys] = adresamp2 (x, y, 40);
plot (x, y, "-", xs, ys, "*");
title ("adaptive resampling")
Produces the following figure
| Figure 1 |
|---|
![]() |
Package: general