Herror ::distance_ss (
    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_ss (
    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 two line segments.

The operator ::distance_ss calculates the minimal and maximal distance between two line segments. As input the rows and columns of the first line segments (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) -> 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 segments

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


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_ss(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_ss returns H_MSG_TRUE.


Alternatives

::distance_pp


See also

::distance_pl, ::distance_ps


Module

Basic operators



Copyright © 1996-2002 MVTec Software GmbH