Operators

# distance_pp (Operator)

## Name

distance_pp — Calculate the distance between two points.

## Signature

distance_pp( : : Row1, Column1, Row2, Column2 : Distance)

## Description

The operator distance_pp calculates the distance between pairs of points according to the following formula:

```   Distance = sqrt((Row1-Row2)^2+(Column1-Column2)^2)
```

The result is returned in Distance.

## Parallelization

• Multithreading type: reentrant (runs in parallel with non-exclusive operators).
• Processed without parallelization.

## Parameters

Row1 (input_control)  point.y(-array) (real / integer)

Row coordinate of the first point.

Column1 (input_control)  point.x(-array) (real / integer)

Column coordinate of the first point.

Row2 (input_control)  point.y(-array) (real / integer)

Row coordinate of the second point.

Column2 (input_control)  point.x(-array) (real / integer)

Column coordinate of the second point.

Distance (output_control)  real(-array) (real)

Distance between the points.

## Example (HDevelop)

```dev_close_window ()
dev_open_window (0, 0, 512, 512, 'white', WindowHandle)
dev_display (Image)
dev_set_color ('black')
threshold (Image, Region, 180, 255)
dev_clear_window ()
dev_display (Region)
connection (Region, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 10000, 100000000)
get_region_contour (SelectedRegions, Rows, Columns)
RowPoint := 80
ColPoint := 250
NumberTuple := |Rows|
dev_set_color ('red')
set_draw (WindowHandle, 'margin')
disp_circle (WindowHandle, RowPoint, ColPoint, 10)
dev_set_color ('green')
for i := 1 to NumberTuple by 10
disp_line (WindowHandle, Rows[i], Columns[i]-2, Rows[i], Columns[i]+2)
disp_line (WindowHandle, Rows[i]-2, Columns[i], Rows[i]+2, Columns[i])
distance_pp (RowPoint, ColPoint, Rows[i], Columns[i], Distance)
endfor
```

## Result

distance_pp returns 2 (H_MSG_TRUE).