]> Creatis software - CreaPhase.git/blob - octave_packages/nurbs-1.3.6/private/nrb_crv_basisfun_der__.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / nurbs-1.3.6 / private / nrb_crv_basisfun_der__.m
1   function [Bu, nbfu] = nrb_crv_basisfun_der__ (points, nrb);
2 %  __NRB_CRV_BASISFUN_DER__: Undocumented internal function
3 %
4 %   Copyright (C) 2009 Carlo de Falco
5 %   This software comes with ABSOLUTELY NO WARRANTY; see the file
6 %   COPYING for details.  This is free software, and you are welcome
7 %   to distribute it under the conditions laid out in COPYING.
8     n    = size (nrb.coefs, 2) -1;
9     p    = nrb.order -1;
10     u    = points;
11     U    = nrb.knots;
12     w    = nrb.coefs(4,:);
13     
14     spu  =  findspan (n, p, u, U);
15     nbfu =  numbasisfun (spu, u, p, U);
16     
17     N     = basisfun (spu, u, p, U);
18
19     Nprime = basisfunder (spu, p, u, U, 1);
20     Nprime = squeeze(Nprime(:,2,:));
21
22     
23     [Dpc, Dpk]  = bspderiv (p, w, U);
24     D           = bspeval  (p, w, U, u);
25     Dprime      = bspeval  (p-1, Dpc, Dpk, u);
26     
27
28     Bu1   = bsxfun (@(np, d) np/d , Nprime.', D);
29     Bu2   = bsxfun (@(n, dp)  n*dp, N.', Dprime./D.^2);
30     Bu    = w(nbfu+1) .* (Bu1 - Bu2).';
31
32   end