Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 0.31 KB | None | 0 0
  1. function P = Casteljau(x, y, t)
  2. n = length(x);
  3. plot(x, y, 'k-o');
  4. legend ('puncte de control');
  5.  hold on;
  6.  axis([0.5, 4.5, 0.2, 2.1]);
  7. for j=1:n-1
  8.   for i=1:j
  9.     x(i)=(1-t)*x(i) + t * x(i+1);
  10.     y(i)=(1-t)*y(i) + t*y(i+1);
  11.    endfor
  12.    plot(x(1:n-j),y(1:n-j),'r-x');
  13.   endfor
  14.  P=[ x(1) y(1) ];
  15. endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement