Operators

# distance_pr (Operator)

## Name

distance_pr — Calculate the distance between a point and a region.

## Signature

distance_pr(Region : : Row, Column : DistanceMin, DistanceMax)

## Description

The operator distance_pr calculates the distance between a point and one region. As input the coordinates of the points (Row,Column) and one region are expected. If a point is inside of the region, its minimum distance is zero. The parameters DistanceMin and DistanceMax return the result of the calculation.

## Parallelization

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

## Parameters

Region (input_object)  region object

Input region.

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

Row coordinate of the point.

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

Column coordinate of the point.

DistanceMin (output_control)  real(-array) (real)

Minimum distance between the point and the region.

DistanceMax (output_control)  real(-array) (real)

Maximum distance between the point and the region.

## Example (HDevelop)

```dev_close_window ()
dev_open_window (0, 0, 512, 512, 'white', WindowHandle)
dev_set_color ('black')
threshold (Image, Region, 180, 255)
connection (Region, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', \
10000, 100000000)
Row1 := 255
Column1 := 255
dev_clear_window ()
dev_display (SelectedRegions)
dev_set_color ('red')
for i := 1 to 360 by 1
Row2 := 255 + sin(rad(i)) * 200
Column2 := 255 + cos(rad(i)) * 200
disp_line (WindowHandle, Row1, Column1, Row2, Column2)
distance_pr (SelectedRegions, Row2, Column2, \
DistanceMin, DistanceMax)
endfor
```

## Result

distance_pr returns 2 (H_MSG_TRUE).