function [xo,yo]=cpRemove(x_cp,y_cp,A,k) % % function [xo,yo]=cpRemove(x_cp,y_cp,A,k) Removes the kth control point, % using the refinement matrix A to repair the damage. [s1,s2]=size(A); if s1 ~= 4 & s2 ~=5 error('The size of A should be 4x5.'); end if min(size(x_cp)) > 1 error('The first input should be a vector.'); end if min(size(y_cp)) > 1 error('The second input should be a vector.'); end if max(size(x_cp)) ~= max(size(y_cp)) error('The first two vectors must have the same length'); end s=max(size(x_cp)); xo=zeros(1,s-1); yo=zeros(1,s-1); xo(1:k-3)=x_cp(1:k-3); yo(1:k-3)=y_cp(1:k-3); xo(k+2:s-1)=x_cp(k+3:s); yo(k+2:s-1)=y_cp(k+3:s); xo(k-2:k+1)=x_cp(k-2:k+2)*A'; yo(k-2:k+1)=y_cp(k-2:k+2)*A';