Bezier curves
Some observations:
- Tangent line at the first point passes through the second.
- Tangent line at the fourth point passes through the third.

Bizier curves and its handles
t = linspace(0, 1, 300) t1 = (1-t).^3 t2 = t.*(1-t).^2 t3 = t.^2.*(1-t) t4 = t.^3 tmat = vertcat(t1, t2, t3, t4) ymove = linspace(0, 1, 4) ymove = ymove(2:end) pointsmat = [] numel(ymove) for idx = 1:numel(ymove) anchorsmat = [0 0.4 0.5 0.6; 0 ymove(idx) 0.5 0] pointsmat = vertcat(pointsmat, anchorsmat * tmat) end pointsmatx = pointsmat(1:2:end, :) pointsmaty = pointsmat(2:2:end, :) plot(pointsmatx', pointsmaty') hold xmove = repmat(0.4, size(ymove), 1) scatter(xmove, ymove) hold on linesegX = vertcat(repmat(0, size(xmove), 1), xmove) linesegY = vertcat(repmat(0, size(ymove), 1), ymove) plot(linesegX, linesegY)
0 comments:
Post a Comment