Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function SqEuclidean(pt1,pt2:TPoint): Double;
- var
- dx,dy: Integer;
- begin
- dx := pt1.x - pt2.x;
- dy := pt1.y - pt2.y;
- Result := dx*dx + dy*dy;
- end;
- function Euclidean(pt1,pt2:TPoint): Double;
- begin
- Result := Sqrt(pow((pt1.x - pt2.x),2) + pow((pt1.y - pt2.y),2));
- end;
- var
- a, b: TPoint;
- begin
- a := Point(44, 55);
- b := Point(13, 16);
- WriteLn('Distance: ' + ToStr(Distance(a.X, a.Y, b.X, b.Y)));
- WriteLn('SqEuclidean: ' + ToStr(SqEuclidean(a, b)));
- WriteLn('Euclidean: ' + ToStr(Euclidean(a, b)));
- end.
Advertisement
Add Comment
Please, Sign In to add comment