Function: polyline = curve2polyline (curve)
Function: polyline = curve2polyline (…,property,value,…)

Adaptive sampling of a parametric curve.

The curve is described as a 2-by-N matrix. Rows correspond to the polynomial (compatible with polyval) describing the respective component of the curve. The curve must be parametrized in the interval [0,1]. The vertices of the polyline are accumulated in regions of the curve where the curvature is higher.

Parameters

'Nmax'

Maximum number of vertices. Not used.

'Tol'

Tolerance for the error criteria. Default value 1e-4.

Currently the area of the smaller triangle formed by three consecutive points on the curve is considered. When this area is smaller than tolerance the points are colinear, and hence no more sampling between these points is needed.

'MaxIter'

Maximum number of iterations. Default value 10.

'Method'

Not implemented.

This function is based on the algorithm described in L. H. de Figueiredo (1993). "Adaptive Sampling of Parametric Curves". Graphic Gems III.

See also: shape2polygon, curveval.

Demonstration 1

The following code

 curve    = [0 0 1 0;1 -0.3-1 0.3 0];
 polyline = curve2polyline(curve,'tol',1e-8);

 t  = linspace(0,1,100)';
 pc = curveval(curve,t);

 plot(polyline(:,1),polyline(:,2),'-o',pc(:,1),pc(:,2),'-r')

Produces the following figure

Figure 1

Package: geometry