Distance between points
FreeLogic@rabbinatix/distance-between-points by Rabbinatixupdated Oct 4, 2026
Straight-line distance from (x1, y1) to (x2, y2).
Pythagoras: the square root of dx² + dy², rounded to 2 decimals.
Shows: Power (its exponent defaults to 2), Square Root.
How to use it
Add it to your logic, then add a Call Function step in any logic and pick Distance. It belongs to no system, so every system can use it. Or download the TypeScript and call it from your own code.
Inputs
x1: Number
y1: Number
x2: Number
y2: Number
Outputs
distance: Number
Previewdrag the steps around; scroll to zoom
Function Entry, Input / output. 0 inputs, 5 outputs. step 1 of 9
Distance
x1
y1
x2
y2
Subtract, Operators. 2 inputs, 1 output. step 2 of 9
-
A
B
result
Subtract, Operators. 2 inputs, 1 output. step 4 of 9
-
A
B
result
Power, Math. 2 inputs, 1 output. step 3 of 9
Power
base
exponent
result
Power, Math. 2 inputs, 1 output. step 5 of 9
Power
base
exponent
result
Add, Operators. 2 inputs, 1 output. step 6 of 9
+
A
B
result
Square Root, Math. 1 input, 1 output. step 7 of 9
Square Root
value
result
Round, Math. 2 inputs, 1 output. step 8 of 9
Round
value
decimals
result
Return, Input / output. 2 inputs, 0 outputs. step 9 of 9
Return
distance
Arrow keys: next or previous step in flow order. Alt with arrows: nearest step in that direction. Enter: open. Shift F10: more actions.
Examplesrun live against the logic · 2/2 pass
| Passed | Example | Input | Output |
|---|---|---|---|
| 3-4-5 | {"x1":0,"y1":0,"x2":3,"y2":4} | {"distance":5} | |
| Diagonal | {"x1":1,"y1":1,"x2":2,"y2":2} | {"distance":1.41} |
Try it
Versions
In this package
Distance (entry)
