function val = deCasteljau(puntiBezier,t)
% Algoritmo di De Casterljau


% schema algoritmo
% b_0^0, b_1^0, b_2^0, ..., b_n^0
% b_0^1, b_1^1, ...., b_{n-1}^1
% b_0^2, b_1^2, ...
% ...

bt = puntiBezier;

[dim,numpunti] = size(bt);
for r = 2:numpunti,
    for i=1:numpunti-r+1,
        % b_i^{r} = (1-t)b_{i}^{r-1} + t b_{i+1}^{r-1}
        bt(:,i) = (1-t)*bt(:,i) + t*bt(:,i+1);
    end
end
val = bt(:,1);
