%STOPCUBICBEZ   Stop Cubic Bezier Curve
% generates the last two control points of a previous curve to finish off a
% sequence of cubic Bezier curves
%
% Syntax:  CP = stopCubicBez(CP, P, vel)
%
% Inputs:
%    CP - control point matrix
%    P - position of the last control point
%    vel - vector giving the desired velocity (dr/dt) at the end of the curve
%
% Outputs:
%    CP - control point matrix
%
% See also: STARTCUBICBEZ, GOTHROUGH

% Author: Travis Hydzik
% Last revision: 19 October 2004

function CP = stopCubicBez(CP, P, vel)

    CP = [ CP
           P - vel/3
           P         ];