NRBBASISFUN: Basis functions for NURBS Calling Sequence: B = nrbbasisfun (u, crv) B = nrbbasisfun ({u, v}, srf) [B, N] = nrbbasisfun ({u, v}, srf) [B, N] = nrbbasisfun (pts, srf) [B, N] = nrbbasisfun ({u, v, w}, vol) [B, N] = nrbbasisfun (pts, vol) INPUT: u - parametric coordinates along u direction v - parametric coordinates along v direction w - parametric coordinates along w direction pts - array of scattered points in parametric domain, array size: (ndim,num_points) crv - NURBS curve srf - NURBS surface vol - NURBS volume If the parametric coordinates are given in a cell-array, the values are computed in a tensor product set of points OUTPUT: B - Value of the basis functions at the points size(B)=[npts, prod(nrb.order)] N - Indices of the basis functions that are nonvanishing at each point. size(N) == size(B) Copyright (C) 2009 Carlo de Falco Copyright (C) 2015 Jacopo Corno Copyright (C) 2016 Rafael Vazquez This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The following code
U = [0 0 0 0 1 1 1 1]; x = [0 1/3 2/3 1] ; y = [0 0 0 0]; w = [1 1 1 1]; nrb = nrbmak ([x;y;y;w], U); u = linspace(0, 1, 30); B = nrbbasisfun (u, nrb); xplot = sum(bsxfun(@(x,y) x.*y, B, x),2); plot(xplot, B) title('Cubic Bernstein polynomials') hold off
Produces the following figure
Figure 1 |
---|
Package: nurbs