function [pCut,isInside,lambda]=getLinearSplitPoints(p1,p2,p3,p4,precision)
% function [pCut,isInside,lambda]=getLinearSplitPoints(p1,p2,p3,p4,precision)
%
% This funciton calculates the cut between two linear segments defined respectively
% by points p1 and p2, and p3 and p4
%
% Input parameters:
% p1, p2-> points defining the first segment, they are two 2D column vector
% p3, p4-> points defining the second segment, they are two 2D column vector
% precision-> indicates the precision at which a point is considered different to other
%
% Output parameters:
% pCut-> intersection between both segments, if empty the segments do not intersect
% isInside-> it is true if the cut is inside segment p1 and p2, otherwise it is false
% lambda-> value of the lambda parameter of the parametric segment between p1 and p2
% where the cut was found
%
% Author: Antonio C. DomÃnguez Brito (adominguez@iusiani.ulpgc.es)
% Institution: SIANI-ULPGC (www.iusiani.ulpgc.es)
% Date: June 2nd 2008
pCut=lineIntersection2D(p1,p2,p3,p4,precision);
if isempty(pCut) isInside=[]; lambda=[];
else
[isInside,lambda]=insideSegment(p1,p2,pCut,precision);
end
return;