2021-07-11 06:10:23 +02:00
|
|
|
function ret = calculateDistanceFromPointToLine(p0 , p1, p2)
|
|
|
|
p01 = p0 - p1;
|
|
|
|
p12 = p2 - p1;
|
|
|
|
CrossProduct = [p01(2)*p12(3) - p01(3)*p12(2), p01(3)*p12(1) - p01(1)*p12(3), p01(1)*p12(2) - p01(2)*p12(1)];
|
2021-07-14 20:09:53 +02:00
|
|
|
ret = norm(CrossProduct) / norm(p12);
|
2021-07-11 06:10:23 +02:00
|
|
|
|
|
|
|
%Height of parallelogram (Distance between point and line) = Area of parallelogram / Base
|
|
|
|
%Area = One side of parallelogram X Base
|
|
|
|
%ret = norm(cross(one side, base))./ norm(base);
|
|
|
|
end
|