Skip to content

distance_srDistanceSrDistanceSrdistance_srdistance_sr🔗

Short description🔗

distance_srDistanceSrDistanceSrdistance_srdistance_sr — Calculate the distance between a line segment and one region.

Signature🔗

distance_sr( region Region, point.y Row1, point.x Column1, point.y Row2, point.x Column2, out real DistanceMin, out real DistanceMax )void DistanceSr( const HObject& Region, const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2, HTuple* DistanceMin, HTuple* DistanceMax )static void HOperatorSet.DistanceSr( HObject region, HTuple row1, HTuple column1, HTuple row2, HTuple column2, out HTuple distanceMin, out HTuple distanceMax )def distance_sr( region: HObject, row_1: MaybeSequence[Union[float, int]], column_1: MaybeSequence[Union[float, int]], row_2: MaybeSequence[Union[float, int]], column_2: MaybeSequence[Union[float, int]] ) -> Tuple[Sequence[float], Sequence[float]]

def distance_sr_s( region: HObject, row_1: MaybeSequence[Union[float, int]], column_1: MaybeSequence[Union[float, int]], row_2: MaybeSequence[Union[float, int]], column_2: MaybeSequence[Union[float, int]] ) -> Tuple[float, float]Herror distance_sr( const Hobject Region, double Row1, double Column1, double Row2, double Column2, double* DistanceMin, double* DistanceMax )

Herror T_distance_sr( const Hobject Region, const Htuple Row1, const Htuple Column1, const Htuple Row2, const Htuple Column2, Htuple* DistanceMin, Htuple* DistanceMax )

void HRegion::DistanceSr( const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2, HTuple* DistanceMin, HTuple* DistanceMax ) const

void HRegion::DistanceSr( double Row1, double Column1, double Row2, double Column2, double* DistanceMin, double* DistanceMax ) const

void HRegion.DistanceSr( HTuple row1, HTuple column1, HTuple row2, HTuple column2, out HTuple distanceMin, out HTuple distanceMax )

void HRegion.DistanceSr( double row1, double column1, double row2, double column2, out double distanceMin, out double distanceMax )

Description🔗

The operator distance_srDistanceSr calculates the distance between a line segment and a region. Row1row1row_1, Column1column1column_1, Row2row2row_2, Column2column2column_2 are the start and end coordinates of a line segment. The parameters DistanceMindistanceMindistance_min and DistanceMaxdistanceMaxdistance_max contain the resulting distances.

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 distances is always N.

Attention🔗

To enhance distance_srDistanceSr, holes are ignored.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

Regionregionregion (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Input region.

Row1row1row_1 (input_control) point.y(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[float, int]]Htuple (double / Hlong)

Row coordinate of the first point of the line segment.

Column1column1column_1 (input_control) point.x(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[float, int]]Htuple (double / Hlong)

Column coordinate of the first point of the line segment.

Row2row2row_2 (input_control) point.y(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[float, int]]Htuple (double / Hlong)

Row coordinate of the second point of the line segment.

Column2column2column_2 (input_control) point.x(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[float, int]]Htuple (double / Hlong)

Column coordinate of the second point of the line segment.

DistanceMindistanceMindistance_min (output_control) real(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Minimum distance between the line segment and the region.

DistanceMaxdistanceMaxdistance_max (output_control) real(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Maximum distance between the line segment and the region.

Example🔗

(HDevelop)

gen_circle (Circle, 200, 200, 100.5)
Column1 := 300
Column2 := 400
for Row := 50 to 350 by 50
  gen_contour_polygon_xld (Line, [Row,Row], [Column1,Column2])
  distance_sr (Circle, Row, Column1, Row, Column2, DistanceMin, DistanceMax)
endfor
(C)
threshold(Image, &Region, 0.0, 120.0)\;
distance_sr(Region,row1,column1,row2,column2
            &distance_min, &distance_max)\;

Result🔗

distance_srDistanceSr returns 2 (H_MSG_TRUE).

Combinations with other operators🔗

Combinations

Alternatives

distance_scDistanceSc, distance_lrDistanceLr, distance_prDistancePr, diameter_regionDiameterRegion

See also

hamming_distanceHammingDistance, select_region_pointSelectRegionPoint, test_region_pointTestRegionPoint, smallest_rectangle2SmallestRectangle2

Module🔗

Foundation