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

Calculate the distances between two line segments.

The operator distance_ss calculates the minimum and maximum distance between two line segments. As input the coordinates of the start and end point of the first line segment (RowA1,ColumnA1, RowA2,ColumnA2) and of the second line segment (RowB1,ColumnB1,RowB2,ColumnB2) are used. The parameters DistanceMin and DistanceMax return the result of the calculation. If the line segments are intersecting, DistanceMin returns zero.


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 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)
number(-array) -> real
Minimum distance between the line segments.

DistanceMax (output_control)
number(-array) -> real
Maximum distance between the line segments.


Example
dev_set_color ('black')
RowLine1 := 400
ColLine1 := 200
RowLine2 := 240
ColLine2 := 400
Rows := 300
Columns := 50
disp_line (WindowHandle, RowLine1, ColLine1, RowLine2, ColLine2)
dev_set_color ('red')
n := 0
for Rows := 40 to 200 by 4
  disp_line (WindowHandle, Rows, Columns, Rows+n, Columns+n)
  distance_ss (Rows, Columns, Rows+n, Columns+n, RowLine1, ColLine1,
               RowLine2, ColLine2, DistanceMin, DistanceMax)
  n := n+8
endfor

Result

distance_ss returns 2 (H_MSG_TRUE).


Parallelization Information

distance_ss is reentrant and processed without parallelization.


Alternatives

distance_pp


See also

distance_pl, distance_ps


Module

Foundation


Up: Tools/Geometry    Top: HALCON Operators
Copyright © 1996-2008 MVTec Software GmbH