distance_sldistance_slDistanceSlDistanceSldistance_sl (Operator)

Name

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

Signature

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

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

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

void DistanceSl(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::DistanceSl(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::DistanceSl(double RowA1, double ColumnA1, double RowA2, double ColumnA2, double RowB1, double ColumnB1, double RowB2, double ColumnB2, double* DistanceMin, double* DistanceMax)

static void HOperatorSet.DistanceSl(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.DistanceSl(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.DistanceSl(double rowA1, double columnA1, double rowA2, double columnA2, double rowB1, double columnB1, double rowB2, double columnB2, out double distanceMin, out double distanceMax)

def distance_sl(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_sl_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_sldistance_slDistanceSlDistanceSldistance_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 (RowA1RowA1RowA1rowA1row_a1,ColumnA1ColumnA1ColumnA1columnA1column_a1,RowA2RowA2RowA2rowA2row_a2,ColumnA2ColumnA2ColumnA2columnA2column_a2) and on the line (RowB1RowB1RowB1rowB1row_b1,ColumnB1ColumnB1ColumnB1columnB1column_b1,RowB2RowB2RowB2rowB2row_b2,ColumnB2ColumnB2ColumnB2columnB2column_b2) are expected. 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'"N""N""N""N". Parameters with tuple length 1 will be repeated internally such that the number of computed distances is always 'N'"N""N""N""N".

Execution Information

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 coordinate 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 segment and the line.

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

Maximum distance between the line segment and the line.

Example (HDevelop)

dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
Row1 := 300
Column1 := 200
Row2 := 100
Column2 := 400
gen_contour_polygon_xld (Line1, [Row1,Row2], [Column1,Column2])
dev_display (Line1)
Column := 50
Row := 100
Offset := 0
for RowEnd := 100 to 500 by 100
  gen_contour_polygon_xld (Line2, [Row,RowEnd], \
                           [Column+Offset,Column+Offset])
  dev_display (Line1)
  distance_sl (Row, Column+Offset, RowEnd, Column+Offset, Row1, Column1, \
               Row2, Column2,DistanceMin, DistanceMax)
  Offset := Offset+40
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_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);

Example (HDevelop)

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

Example (HDevelop)

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

Result

distance_sldistance_slDistanceSlDistanceSldistance_sl returns 2 ( H_MSG_TRUE) .

Alternatives

distance_pldistance_plDistancePlDistancePldistance_pl

See also

distance_psdistance_psDistancePsDistancePsdistance_ps, distance_ppdistance_ppDistancePpDistancePpdistance_pp

Module

Foundation