Makefile MSLEEP
[wrf-fire-matlab.git] / ignition / line_dist.m
blobc4b36dc500854e279128281c9574eee2d241a367
1 function dist=line_dist(x1,y1,x2,y2,x3,y3)
3 % Volodymyr Kondratenko           August 2011
5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 % finds the distance from (x3,y3) to line through (x1,y1) and (x2,y2)
8 A=y1-y2;
9 B=x2-x1;
10 C=x1*y2-y1*x2;
11 dist=(abs(A*x3+B*y3+C))/(sqrt(A*A+B*B));
13 end