changeset 11689:a5e636ebf237 octave-forge

Fixed bug for one single point. Compute function value and derivative with basisfunder
author rafavzqz
date Wed, 08 May 2013 12:49:14 +0000
parents 101a3bd532ed
children e7edce4e5688
files extra/nurbs/inst/private/nrb_crv_basisfun_der__.m
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/extra/nurbs/inst/private/nrb_crv_basisfun_der__.m	Sun May 05 16:18:48 2013 +0000
+++ b/extra/nurbs/inst/private/nrb_crv_basisfun_der__.m	Wed May 08 12:49:14 2013 +0000
@@ -1,10 +1,13 @@
-  function [Bu, nbfu] = nrb_crv_basisfun_der__ (points, nrb);
+  function [Bu, nbfu] = nrb_crv_basisfun_der__ (points, nrb)
 %  __NRB_CRV_BASISFUN_DER__: Undocumented internal function
 %
 %   Copyright (C) 2009 Carlo de Falco
+%   Copyright (C) 2013 Rafael Vazquez
+%
 %   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;
@@ -13,17 +16,16 @@
     
     spu  =  findspan (n, p, u, U);
     nbfu =  numbasisfun (spu, u, p, U);
-    
-    N     = basisfun (spu, u, p, U);
 
     Nprime = basisfunder (spu, p, u, U, 1);
-    Nprime = squeeze(Nprime(:,2,:));
+    N = reshape (Nprime(:,1,:), numel(u), p+1);
+    Nprime = reshape (Nprime(:,2,:), numel(u), p+1);
 
-    
+
     [Dpc, Dpk]  = bspderiv (p, w, U);
     D           = bspeval  (p, w, U, u);
     Dprime      = bspeval  (p-1, Dpc, Dpk, u);
-    
+
 
     Bu1   = bsxfun (@(np, d) np/d , Nprime.', D);
     Bu2   = bsxfun (@(n, dp)  n*dp, N.', Dprime./D.^2);