Operator Reference

distance_ssdistance_ssDistanceSsDistanceSsdistance_ss (Operator)

distance_ssdistance_ssDistanceSsDistanceSsdistance_ss — Calculate the distances between two line segments.

Signature

Herror distance_ss(double RowA1, double ColumnA1, double RowA2, double ColumnA2, double RowB1, double ColumnB1, double RowB2, double ColumnB2, double* DistanceMin, double* DistanceMax)

Herror T_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)

void DistanceSs(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)

static void HMisc::DistanceSs(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)

static void HMisc::DistanceSs(double RowA1, double ColumnA1, double RowA2, double ColumnA2, double RowB1, double ColumnB1, double RowB2, double ColumnB2, double* DistanceMin, double* DistanceMax)

static void HOperatorSet.DistanceSs(HTuple rowA1, HTuple columnA1, HTuple rowA2, HTuple columnA2, HTuple rowB1, HTuple columnB1, HTuple rowB2, HTuple columnB2, out HTuple distanceMin, out HTuple distanceMax)

static void HMisc.DistanceSs(HTuple rowA1, HTuple columnA1, HTuple rowA2, HTuple columnA2, HTuple rowB1, HTuple columnB1, HTuple rowB2, HTuple columnB2, out HTuple distanceMin, out HTuple distanceMax)

static void HMisc.DistanceSs(double rowA1, double columnA1, double rowA2, double columnA2, double rowB1, double columnB1, double rowB2, double columnB2, out double distanceMin, out double distanceMax)

def distance_ss(row_a1: MaybeSequence[Union[float, int]], column_a1: MaybeSequence[Union[float, int]], row_a2: MaybeSequence[Union[float, int]], column_a2: MaybeSequence[Union[float, int]], row_b1: MaybeSequence[Union[float, int]], column_b1: MaybeSequence[Union[float, int]], row_b2: MaybeSequence[Union[float, int]], column_b2: MaybeSequence[Union[float, int]]) -> Tuple[Sequence[float], Sequence[float]]

def distance_ss_s(row_a1: MaybeSequence[Union[float, int]], column_a1: MaybeSequence[Union[float, int]], row_a2: MaybeSequence[Union[float, int]], column_a2: MaybeSequence[Union[float, int]], row_b1: MaybeSequence[Union[float, int]], column_b1: MaybeSequence[Union[float, int]], row_b2: MaybeSequence[Union[float, int]], column_b2: MaybeSequence[Union[float, int]]) -> Tuple[float, float]

Description

The operator distance_ssdistance_ssDistanceSsDistanceSsdistance_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 (RowA1RowA1RowA1rowA1row_a1,ColumnA1ColumnA1ColumnA1columnA1column_a1, RowA2RowA2RowA2rowA2row_a2,ColumnA2ColumnA2ColumnA2columnA2column_a2) and of the second line segment (RowB1RowB1RowB1rowB1row_b1,ColumnB1ColumnB1ColumnB1columnB1column_b1,RowB2RowB2RowB2rowB2row_b2,ColumnB2ColumnB2ColumnB2columnB2column_b2) are used. The parameters DistanceMinDistanceMinDistanceMindistanceMindistance_min and DistanceMaxDistanceMaxDistanceMaxdistanceMaxdistance_max return the result of the calculation. If the line segments are intersecting, DistanceMinDistanceMinDistanceMindistanceMindistance_min returns zero.

Parameter Broadcasting

This operator supports parameter broadcasting. This means that each parameter can be given as a tuple of length 1 or N. Parameters with tuple length 1 will be repeated internally such that the number of computed distances is always N.

Execution Information

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Automatically parallelized on internal data level.

Parameters

RowA1RowA1RowA1rowA1row_a1 (input_control)  point.y(-array) HTupleMaybeSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Row coordinate of the first point of the line segment.

ColumnA1ColumnA1ColumnA1columnA1column_a1 (input_control)  point.x(-array) HTupleMaybeSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Column coordinate of the first point of the line segment.

RowA2RowA2RowA2rowA2row_a2 (input_control)  point.y(-array) HTupleMaybeSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Row coordinate of the second point of the line segment.

ColumnA2ColumnA2ColumnA2columnA2column_a2 (input_control)  point.x(-array) HTupleMaybeSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Column coordinate of the second point of the line segment.

RowB1RowB1RowB1rowB1row_b1 (input_control)  point.y(-array) HTupleMaybeSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Row coordinate of the first point of the line.

ColumnB1ColumnB1ColumnB1columnB1column_b1 (input_control)  point.x(-array) HTupleMaybeSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Column of the first point of the line.

RowB2RowB2RowB2rowB2row_b2 (input_control)  point.y(-array) HTupleMaybeSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Row coordinate of the second point of the line.

ColumnB2ColumnB2ColumnB2columnB2column_b2 (input_control)  point.x(-array) HTupleMaybeSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Column coordinate of the second point of the line.

DistanceMinDistanceMinDistanceMindistanceMindistance_min (output_control)  real(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Minimum distance between the line segments.

DistanceMaxDistanceMaxDistanceMaxdistanceMaxdistance_max (output_control)  real(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Maximum distance between the line segments.

Example (HDevelop)

dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
Row1 := 300
Column1 := 200
Row2 := 100
Column2 := 300
gen_contour_polygon_xld (Line1, [Row1,Row2], [Column1,Column2])
Column := 100
Offset := 30
for Row := 40 to 100 by 20
  gen_contour_polygon_xld (Line2, [Row, Row+Offset], \
                           [Column, Column+Offset])
  distance_ss (Row, Column, Row+Offset, Column+Offset, Row1, Column1, \
               Row2, Column2, DistanceMin, DistanceMax)
  Offset := Offset+50
endfor

Example (C)

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);

Example (HDevelop)

dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
Row1 := 300
Column1 := 200
Row2 := 100
Column2 := 300
gen_contour_polygon_xld (Line1, [Row1,Row2], [Column1,Column2])
Column := 100
Offset := 30
for Row := 40 to 100 by 20
  gen_contour_polygon_xld (Line2, [Row, Row+Offset], \
                           [Column, Column+Offset])
  distance_ss (Row, Column, Row+Offset, Column+Offset, Row1, Column1, \
               Row2, Column2, DistanceMin, DistanceMax)
  Offset := Offset+50
endfor

Example (HDevelop)

dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
Row1 := 300
Column1 := 200
Row2 := 100
Column2 := 300
gen_contour_polygon_xld (Line1, [Row1,Row2], [Column1,Column2])
Column := 100
Offset := 30
for Row := 40 to 100 by 20
  gen_contour_polygon_xld (Line2, [Row, Row+Offset], \
                           [Column, Column+Offset])
  distance_ss (Row, Column, Row+Offset, Column+Offset, Row1, Column1, \
               Row2, Column2, DistanceMin, DistanceMax)
  Offset := Offset+50
endfor

Result

distance_ssdistance_ssDistanceSsDistanceSsdistance_ss returns 2 ( H_MSG_TRUE) .

Alternatives

distance_ppdistance_ppDistancePpDistancePpdistance_pp

See also

distance_pldistance_plDistancePlDistancePldistance_pl, distance_psdistance_psDistancePsDistancePsdistance_ps

Module

Foundation