You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: createLine.m
    path of file: ./repos/matImage/matImage/imMinkowski/private
    
    the code of the file until where you have to start completion: function line = createLine(varargin)
%CREATELINE Create a straight line from 2 points, or from other inputs
%
%   Line is represented in a parametric form : [x0 y0 dx dy]
%   x = x0 + t*dx
%   y = y0 + t*dy;
%
%
%   L = createLine(p1, p2);
%   Returns the line going through the two given points.
%   
%   L = createLine(x0, y0, dx, dy);
%   Returns the line going through point (x0, y0) and with direction
%   vector(dx, dy).
%
%   L = createLine(LINE);
%   where LINE is an array of 4 values, creates the line going through the
%   point (LINE(1) LINE(2)), and with direction given by vector (LINE(3)
%   LINE(4)). 
%   
%   L = createLine(THETA);
%   Create a polar line originated at (0,0) and with angle THETA.
%
%   L = createLine(RHO, THETA);
%   Create a polar line with normal theta, and with min distance to origin
%   equal to rho. rho can be negative, in this case, the line is the same
%   as with CREATELINE(-rho, theta+pi), but the orientation is different.
%
%
%   Note: in all cases, parameters can be vertical arrays of the same
%   dimension. The result is then an array of lines, of dimensions [N*4].
%
%
%   See also:
%   lines2d, createEdge, createRay
%
%   ---------
%   author : David Legland 
%   INRA - TPV URPOI - BIA IMASTE
%   created the 31/10/2003.
%

%   HISTORY :
%   18/02/2004 : add more possibilities to create lines (4 parameters,
%      all param in a single tab, and point + dx + dy.
%      Also add support for creation of arrays of lines.

%   NOTE : A line can also be represented with a 1*5 array : 
%   [x0 y0 dx dy t].
%   whith 't' being one of the following : 
%   - t=0 : line is a singleton (x0,y0)
%   - t=1 : line is an edge segment, between points (x0,y0) and (x0+dx,
%   y0+dy).
%   - t=Inf : line is a Ray, originated from (x0,y0) and going to infinity
%   in the direction(dx,dy).
%   - t=-Inf : line is a Ray, originated from (x0,y0) and going to infinity
%   in the direction(-dx,-dy).
%   - t=NaN : line is a real straight line, and contains all points
%   verifying the above equation.

    
function line = createLine(varargin)
%CREATELINE Create a straight line from 2 points, or from other inputs
%
%   Line is represented in a parametric form : [x0 y0 dx dy]
%   x = x0 + t*dx
%   y = y0 + t*dy;
%
%
%   L = createLine(p1, p2);
%   Returns the line going through the two given points.
%   
%   L = createLine(x0, y0, dx, dy);
%   Returns the line going through point (x0, y0) and with direction
%   vector(dx, dy).
%
%   L = createLine(LINE);
%   where LINE is an array of 4 values, creates the line going through the
%   point (LINE(1) LINE(2)), and with direction given by vector (LINE(3)
%   LINE(4)). 
%   
%   L = createLine(THETA);
%   Create a polar line originated at (0,0) and with angle THETA.
%
%   L = createLine(RHO, THETA);
%   Create a polar line with normal theta, and with min distance to origin
%   equal to rho. rho can be negative, in this case, the line is the same
%   as with CREATELINE(-rho, theta+pi), but the orientation is different.
%
%
%   Note: in all cases, parameters can be vertical arrays of the same
%   dimension. The result is then an array of lines, of dimensions [N*4].
%
%
%   See also:
%   lines2d, createEdge, createRay
%
%   ---------
%   author : David Legland 
%   INRA - TPV URPOI - BIA IMASTE
%   created the 31/10/2003.
%

%   HISTORY :
%   18/02/2004 : add more possibilities to create lines (4 parameters,
%      all param in a single tab, and point + dx + dy.
%      Also add support for creation of arrays of lines.

%   NOTE : A line can also be represented with a 1*5 array : 
%   [x0 y0 dx dy t].
%   whith 't' being one of the following : 
%   - t=0 : line is a singleton (x0,y0)
%   - t=1 : line is an edge segment, between points (x0,y0) and (x0+dx,
%   y0+dy).
%   - t=Inf : line is a Ray, originated from (x0,y0) and going to infinity
%   in the direction(dx,dy).
%   - t=-Inf : line is a Ray, originated from (x0,y0) and going to infinity
%   in the direction(-dx,-dy).
%   - t=NaN : line is a real straight line, and contains all points
%   verifying the above equation.
%   This seems us a convenient way to represent uniformly all kind of lines
%   (including edges, rays, and even point).
%

%   NOTE2 : Any line object can be represented using a 1x6 array :
%   [x0 y0 dx dy t0 t1]
%   the first 4 parameters define the supporting line,
%   t0 represent the position of the first point on the line, 
%   and t1 the position of the last point.
%   * for edges : t0 = 0, and t1=1
%   * for straight lines : t0 = -inf, t1=inf
%   * for rays : t0=0, t1=inf (or t0=-inf,t1=0 for inverted ray).
%   I propose to call these objects 'lineArc'

if length(varargin)==1
    % Only one input parameter. It can be :
    % - line angle
    % - array of four parameters
    % TODO : add control for arrays of lines.
    var = varargin{1};
    
    if size(var, 2)==4
        % 4 parameters of the line in a single array.
        line = var;
    elseif size(var, 2)==1
        % 1 parameter : angle of the line, going through origin.
        line = [zeros(size(var)) zeros(size(var)) cos(var) sin(var)];
    else
        error('wrong number of dimension for arg1 : can be 1 or 4');
    end