ClassesClasses | | Operators

distance_ssdistance_ssDistanceSsDistanceSs (Operator)

Name

distance_ssdistance_ssDistanceSsDistanceSs — Calculate the distances between two line segments.

Signature

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

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)

Description

The operator distance_ssdistance_ssDistanceSsDistanceSsDistanceSs 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 (RowA1RowA1RowA1RowA1rowA1,ColumnA1ColumnA1ColumnA1ColumnA1columnA1, RowA2RowA2RowA2RowA2rowA2,ColumnA2ColumnA2ColumnA2ColumnA2columnA2) and of the second line segment (RowB1RowB1RowB1RowB1rowB1,ColumnB1ColumnB1ColumnB1ColumnB1columnB1,RowB2RowB2RowB2RowB2rowB2,ColumnB2ColumnB2ColumnB2ColumnB2columnB2) are used. The parameters DistanceMinDistanceMinDistanceMinDistanceMindistanceMin and DistanceMaxDistanceMaxDistanceMaxDistanceMaxdistanceMax return the result of the calculation. If the line segments are intersecting, DistanceMinDistanceMinDistanceMinDistanceMindistanceMin returns zero.

Execution Information

Parameters

RowA1RowA1RowA1RowA1rowA1 (input_control)  point.y(-array) HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Row coordinate of the first point of the line segment.

ColumnA1ColumnA1ColumnA1ColumnA1columnA1 (input_control)  point.x(-array) HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Column coordinate of the first point of the line segment.

RowA2RowA2RowA2RowA2rowA2 (input_control)  point.y(-array) HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Row coordinate of the second point of the line segment.

ColumnA2ColumnA2ColumnA2ColumnA2columnA2 (input_control)  point.x(-array) HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Column coordinate of the second point of the line segment.

RowB1RowB1RowB1RowB1rowB1 (input_control)  point.y(-array) HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Row coordinate of the first point of the line.

ColumnB1ColumnB1ColumnB1ColumnB1columnB1 (input_control)  point.x(-array) HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Column of the first point of the line.

RowB2RowB2RowB2RowB2rowB2 (input_control)  point.y(-array) HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Row coordinate of the second point of the line.

ColumnB2ColumnB2ColumnB2ColumnB2columnB2 (input_control)  point.x(-array) HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Column coordinate of the second point of the line.

DistanceMinDistanceMinDistanceMinDistanceMindistanceMin (output_control)  real(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Minimum distance between the line segments.

DistanceMaxDistanceMaxDistanceMaxDistanceMaxdistanceMax (output_control)  real(-array) HTupleHTupleHtuple (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

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_ssDistanceSsDistanceSsDistanceSs returns 2 (H_MSG_TRUE).

Alternatives

distance_ppdistance_ppDistancePpDistancePpDistancePp

See also

distance_pldistance_plDistancePlDistancePlDistancePl, distance_psdistance_psDistancePsDistancePsDistancePs

Module

Foundation


ClassesClasses | | Operators