Herror ::distance_sl (
    const HTuple &RowA1,
    const HTuple &ColumnA1,
    const HTuple &RowA2,
    const HTuple &ColumnA2,
    const HTuple &RowB1,
    const HTuple &ColumnB1,
    const HTuple &RowB2,
    const HTuple &ColumnB2,
    double *DistanceMin,
    double *DistanceMax
)
Herror ::distance_sl (
    const HTuple &RowA1,
    const HTuple &ColumnA1,
    const HTuple &RowA2,
    const HTuple &ColumnA2,
    const HTuple &RowB1,
    const HTuple &ColumnB1,
    const HTuple &RowB2,
    const HTuple &ColumnB2,
    HTuple *DistanceMin,
    HTuple *DistanceMax
)

Calculate the distances between one line segment and one line.

The operator ::distance_sl calculates the minimal and maximal orthogonal distance between one line segment and one line. As input the columns and rows of the line segment (RowA1,ColumnA1,RowA2,ColumnA2) and of 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.


Parameters

RowA1 (input_control)
point.y(-array) -> HTuple.double / long
Row of the first point of the line segment.

ColumnA1 (input_control)
point.x(-array) -> HTuple.double / long
Column of the first point of the line segment.

RowA2 (input_control)
point.y(-array) -> HTuple.double / long
Row of the second point of the line segment.

ColumnA2 (input_control)
point.x(-array) -> HTuple.double / long
Column of the second point of the line segment.

RowB1 (input_control)
point.y(-array) -> HTuple.double / long
Row of the first point of the line.

ColumnB1 (input_control)
point.x(-array) -> HTuple.double / long
Column of the first point of the line.

RowB2 (input_control)
point.y(-array) -> HTuple.double / long
Row of the second point of the line.

ColumnB2 (input_control)
point.x(-array) -> HTuple.double / long
Column of the second point of the line.

DistanceMin (output_control)
number(-array) -> (HTuple.) double *
Minimal distance between the line segment and the line

DistanceMax (output_control)
number(-array) -> (HTuple.) double *
Maximal distance between the line segment and the line


Example
create_tuple(&RowA1, 1);
set_i(RowA1, 8, 0);
create_tuple(&ColumnA1, 1);
set_i(ColumnA1, 7, 0);
create_tuple(&RowA2, 1);
set_i(RowA2, 15, 0);
create_tuple(&ColumnA2, 1);
set_i(ColumnA2, 11, 0);
create_tuple(&RowB1, 1);
set_i(RowB1, 2, 0);
create_tuple(&ColumnB1, 1);
set_i(ColumnB1, 4, 0);
create_tuple(&RowB2, 1);
set_i(RowB2, 6, 0);
create_tuple(&ColumnB2, 1);
set_i(ColumnB2, 10, 0);
T_distance_sl(RowA1,ColumnA1,RowA2,ColumnA2,RowB1,ColumnB1,RowB2,ColumnB2,
              &distance_min,&distance_max);
aa_min = get_d(distance_min,0);
aa_max = get_d(distance_max,0);

Result

::distance_sl returns H_MSG_TRUE.


Alternatives

::distance_pl


See also

::distance_ps, ::distance_pp


Module

Basic operators



Copyright © 1996-2002 MVTec Software GmbH