Difference between revisions of "Distance"
From SCAR Divi Manual
Line 23: | Line 23: | ||
==Description== | ==Description== | ||
− | Calculates the [http://mathworld.wolfram.com/Distance.html distance] between 2 given points defined by (''' | + | Calculates the [http://mathworld.wolfram.com/Distance.html distance] between 2 given points defined by ('''X1''', '''Y1''') and ('''X2''', '''Y2'''). |
==Example== | ==Example== |
Revision as of 14:53, 12 November 2012
Definition
function Distance(const X1, Y1, X2, Y2: Integer): Extended;
Source Code
function MyDistance(const X1, Y1, X2, Y2: Integer): Extended; var A, B: Extended; begin A := X1 - X2; B := Y1 - Y2; Result := Sqrt(A * A + B * B); end;
Availability
SCAR Divi 3.00 > Current
- Before 3.21 the workaround for larger distances was not yet implemented.
- Bedore 3.37 returned an integer value
Description
Calculates the distance between 2 given points defined by (X1, Y1) and (X2, Y2).
Example
begin WriteLn(Distance(5, 6, 8, 9)); end.
Output:
4.24264068711929