Operators

# distance_sl (Operator)

## Name

distance_sl — Calculate the distances between a line segment and a line.

## Signature

distance_sl( : : RowA1, ColumnA1, RowA2, ColumnA2, RowB1, ColumnB1, RowB2, ColumnB2 : DistanceMin, DistanceMax)

## Description

The operator distance_sl calculates the minimum and maximum orthogonal distance between a line segment and a line. As input the coordinates of two points on the line segment (RowA1,ColumnA1,RowA2,ColumnA2) and on the line (RowB1,ColumnB1,RowB2,ColumnB2) are expected. The parameters DistanceMin and DistanceMax return the result of the calculation. If the line segments are intersecting, DistanceMin returns zero.

## Parallelization

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

## Parameters

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

Row coordinate of the first point of the line segment.

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

Column coordinate of the first point of the line segment.

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

Row coordinate of the second point of the line segment.

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

Column coordinate of the second point of the line segment.

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

Row coordinate of the first point of the line.

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

Column coordinate of the first point of the line.

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

Row coordinate of the second point of the line.

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

Column coordinate of the second point of the line.

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

Minimum distance between the line segment and the line.

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

Maximum distance between the line segment and the line.

## Example (HDevelop)

```dev_set_color ('black')
RowLine1 := 400
ColLine1 := 200
RowLine2 := 200
ColLine2 := 400
Rows := 300
Columns := 50
disp_line (WindowHandle, RowLine1, ColLine1, RowLine2, ColLine2)
dev_set_color ('green')
n := 0
for Rows := 40 to 200 by 4
disp_line (WindowHandle, Rows+n, Columns+n, Rows, Columns+n)
distance_sl (Rows+n, Columns+n, Rows, Columns+n, RowLine1, ColLine1, \
RowLine2, ColLine2,DistanceMin, DistanceMax)
n := n+10
endfor
```

## Result

distance_sl returns 2 (H_MSG_TRUE).