A set of
data points with rectangular Cartesian coordinates
are sorted into panels defined by lines parallel to the
and
axes. The intercepts of these lines on the
and
axes are given in
, for
and
, for
, respectively. The function orders the data so that all points in a panel occur before data in succeeding panels, where the panels are numbered from bottom to top and then left to right, with the usual arrangement of axes, as shown in the diagram. Within a panel the points maintain their original order.
Figure 1
A data point lying exactly on one or more panel sides is taken to be in the highest-numbered panel adjacent to the point. The function does not physically rearrange the data, but provides the array
point which contains a linked list for each panel, pointing to the data in that panel. The total number of panels is
.
None.
Not applicable.
This function was written to sort two-dimensional data in the manner required by function
nag_fit_2dspline_panel (e02da). The first
arguments of
nag_fit_2dspline_sort (e02za) are the same as the arguments in
nag_fit_2dspline_panel (e02da) which have the same name.
This example reads in data points and the intercepts of the panel sides on the
and
axes; it calls
nag_fit_2dspline_sort (e02za) to set up the index array
point; and finally it prints the data points in panel order.
function e02za_example
fprintf('e02za example results\n\n');
xknots = [1]; kx = size(xknots,2);
yknots = [0.8 1.2]; ky = size(yknots,2);
lamda = zeros(kx+8,1);
mu = zeros(ky+8,1);
lamda(5:kx+4) = xknots;
mu(5:ky+4) = yknots;
x = [0.00 0.70 1.44 0.21 1.01 1.84 0.71 1.00 0.54 1.53];
y = [0.77 1.06 0.33 0.44 0.50 0.02 1.95 1.20 0.04 0.18];
m = size(x,2);
[point, ifail] = e02za(lamda, mu, x, y);
for i = 1:(kx+1)*(ky+1)
fprintf('\nPanel %4d\n', i);
ip = m + i;
while ip>0
ip = point(ip);
if (ip>0)
fprintf('%7.2f%7.2f\n',x(ip), y(ip));
end
end
end