]> Creatis software - CreaPhase.git/blob - octave_packages/nurbs-1.3.6/private/nrb_srf_numbasisfun__.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / nurbs-1.3.6 / private / nrb_srf_numbasisfun__.m
1 function idx = nrb_srf_numbasisfun__ (points, nrb)
2
3 %  __NRB_SRF_NUMBASISFUN__: Undocumented internal function
4 %
5 %   Copyright (C) 2009 Carlo de Falco
6 %   This software comes with ABSOLUTELY NO WARRANTY; see the file
7 %   COPYING for details.  This is free software, and you are welcome
8 %   to distribute it under the conditions laid out in COPYING.
9   
10   m   = nrb.number(1)-1;
11   n   = nrb.number(2)-1;
12   
13   npt = size(points,2);
14   u   = points(1,:);
15   v   = points(2,:);
16
17   U   = nrb.knots{1};
18   V   = nrb.knots{2};
19
20   p   = nrb.order(1)-1;
21   q   = nrb.order(2)-1;
22
23   spu = findspan (m, p, u, U); 
24   Ik  = numbasisfun (spu, u, p, U);
25
26   spv = findspan (n, q, v, V);
27   Jk  = numbasisfun (spv, v, q, V);
28   
29   for k=1:npt
30     [Jkb, Ika] = meshgrid(Jk(k, :), Ik(k, :)); 
31     idx(k, :)  = sub2ind([m+1, n+1], Ika(:)+1, Jkb(:)+1);
32   end
33
34 end