X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=CreaPhase.git;a=blobdiff_plain;f=octave_packages%2Fnurbs-1.3.6%2Fprivate%2Fnrb_srf_basisfun_der__.m;fp=octave_packages%2Fnurbs-1.3.6%2Fprivate%2Fnrb_srf_basisfun_der__.m;h=9524f91b4eccfdc4a69b1f3222dc081da8cf9fa7;hp=0000000000000000000000000000000000000000;hb=c880e8788dfc484bf23ce13fa2787f2c6bca4863;hpb=1705066eceaaea976f010f669ce8e972f3734b05 diff --git a/octave_packages/nurbs-1.3.6/private/nrb_srf_basisfun_der__.m b/octave_packages/nurbs-1.3.6/private/nrb_srf_basisfun_der__.m new file mode 100644 index 0000000..9524f91 --- /dev/null +++ b/octave_packages/nurbs-1.3.6/private/nrb_srf_basisfun_der__.m @@ -0,0 +1,52 @@ +function [Bu, Bv, N] = nrb_srf_basisfun_der__ (points, nrb); + +% __NRB_SRF_BASISFUN_DER__: 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. + + m = size (nrb.coefs, 2) -1; + n = size (nrb.coefs, 3) -1; + + p = nrb.order(1) -1; + q = nrb.order(2) -1; + + u = points(1,:); + v = points(2,:); + npt = length(u); + + U = nrb.knots{1}; + V = nrb.knots{2}; + + w = squeeze(nrb.coefs(4,:,:)); + + spu = findspan (m, p, u, U); + spv = findspan (n, q, v, V); + N = nrbnumbasisfun (points, nrb); + + NuIkuk = basisfun (spu, u, p, U); + NvJkvk = basisfun (spv, v, q, V); + + NuIkukprime = basisfunder (spu, p, u, U, 1); + NuIkukprime = reshape (NuIkukprime(:,2,:), npt, []); + + NvJkvkprime = basisfunder (spv, q, v, V, 1); + NvJkvkprime = reshape (NvJkvkprime(:,2,:), npt, []); + + for k=1:npt + wIkaJkb(1:p+1, 1:q+1) = reshape (w(N(k, :)), p+1, q+1); + + Num = (NuIkuk(k, :).' * NvJkvk(k, :)) .* wIkaJkb; + Num_du = (NuIkukprime(k, :).' * NvJkvk(k, :)) .* wIkaJkb; + Num_dv = (NuIkuk(k, :).' * NvJkvkprime(k, :)) .* wIkaJkb; + Denom = sum(sum(Num)); + Denom_du = sum(sum(Num_du)); + Denom_dv = sum(sum(Num_dv)); + + Bu(k, :) = reshape((Num_du/Denom - Denom_du.*Num/Denom.^2),1,[]); + Bv(k, :) = reshape((Num_dv/Denom - Denom_dv.*Num/Denom.^2),1,[]); + end + +end \ No newline at end of file