Home > track > linesIntersection.m

linesIntersection

PURPOSE ^

% According to MathWorld http://mathworld.wolfram.com/Line-LineIntersection.html

SYNOPSIS ^

function [x,y] = linesIntersection(x1,y1,x2,y2,x3,y3,x4,y4)

DESCRIPTION ^

% According to MathWorld http://mathworld.wolfram.com/Line-LineIntersection.html

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [x,y] = linesIntersection(x1,y1,x2,y2,x3,y3,x4,y4)
0002 %% According to MathWorld http://mathworld.wolfram.com/Line-LineIntersection.html
0003 
0004 x = det( [det([x1 y1;x2 y2]) x1-x2; det([x3 y3; x4 y4]) x3-x4] ) / det( [x1-x2 y1-y2; x3-x4 y3-y4]);
0005 
0006 y = det( [det([x1 y1;x2 y2]) y1-y2; det([x3 y3; x4 y4]) y3-y4] ) / det( [x1-x2 y1-y2; x3-x4 y3-y4]);
0007 
0008

Generated on Thu 17-Mar-2011 14:45:51 by m2html © 2005