]> Creatis software - CreaPhase.git/blobdiff - octave_packages/nurbs-1.3.6/private/nrb_crv_basisfun__.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / nurbs-1.3.6 / private / nrb_crv_basisfun__.m
diff --git a/octave_packages/nurbs-1.3.6/private/nrb_crv_basisfun__.m b/octave_packages/nurbs-1.3.6/private/nrb_crv_basisfun__.m
new file mode 100644 (file)
index 0000000..8278e4b
--- /dev/null
@@ -0,0 +1,20 @@
+  function [B, nbfu] = nrb_crv_basisfun__ (points, nrb);
+%  __NRB_CRV_BASISFUN__: Undocumented internal function
+%
+%   Copyright (C) 2009 Carlo de Falco
+%   This software comes with ABSOLUTELY NO WARRANTY; see the file
+%   COPYING for details.  This is free software, and you are welcome
+%   to distribute it under the conditions laid out in COPYING.
+    n    = size (nrb.coefs, 2) -1;
+    p    = nrb.order -1;
+    u    = points;
+    U    = nrb.knots;
+    w    = nrb.coefs(4,:);
+    
+    spu  =  findspan (n, p, u, U); 
+    nbfu =  numbasisfun (spu, u, p, U);
+    
+    N     = w(nbfu+1) .* basisfun (spu, u, p, U);
+    B     = bsxfun (@(x,y) x./y, N, sum (N,2));
+
+  end