Skip to content

distance_cc_min_pointsdistance_cc_min_pointsDistanceCcMinPointsDistanceCcMinPointsdistance_cc_min_pointsdistance_cc_min_points🔗

Short description🔗

distance_cc_min_pointsdistance_cc_min_pointsDistanceCcMinPointsDistanceCcMinPointsdistance_cc_min_pointsdistance_cc_min_points — Calculate the minimum distance between two contours and the points used for the calculation.

Signature🔗

distance_cc_min_points( xld_cont Contour1, xld_cont Contour2, string Mode, out number DistanceMin, out point.y Row1, out point.x Column1, out point.y Row2, out point.x Column2 )distance_cc_min_points( Contour1, Contour2 : : Mode : DistanceMin, Row1, Column1, Row2, Column2 )void DistanceCcMinPoints( const HObject& Contour1, const HObject& Contour2, const HTuple& Mode, HTuple* DistanceMin, HTuple* Row1, HTuple* Column1, HTuple* Row2, HTuple* Column2 )static void HOperatorSet.DistanceCcMinPoints( HObject contour1, HObject contour2, HTuple mode, out HTuple distanceMin, out HTuple row1, out HTuple column1, out HTuple row2, out HTuple column2 )def distance_cc_min_points( contour_1: HObject, contour_2: HObject, mode: MaybeSequence[str] ) -> Tuple[Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[float]]

def distance_cc_min_points_s( contour_1: HObject, contour_2: HObject, mode: MaybeSequence[str] ) -> Tuple[float, float, float, float, float]Herror distance_cc_min_points( const Hobject Contour1, const Hobject Contour2, const char* Mode, double* DistanceMin, double* Row1, double* Column1, double* Row2, double* Column2 )

Herror T_distance_cc_min_points( const Hobject Contour1, const Hobject Contour2, const Htuple Mode, Htuple* DistanceMin, Htuple* Row1, Htuple* Column1, Htuple* Row2, Htuple* Column2 )

HTuple HXLDCont::DistanceCcMinPoints( const HXLDCont& Contour2, const HTuple& Mode, HTuple* Row1, HTuple* Column1, HTuple* Row2, HTuple* Column2 ) const

double HXLDCont::DistanceCcMinPoints( const HXLDCont& Contour2, const HString& Mode, double* Row1, double* Column1, double* Row2, double* Column2 ) const

double HXLDCont::DistanceCcMinPoints( const HXLDCont& Contour2, const char* Mode, double* Row1, double* Column1, double* Row2, double* Column2 ) const

double HXLDCont::DistanceCcMinPoints( const HXLDCont& Contour2, const wchar_t* Mode, double* Row1, double* Column1, double* Row2, double* Column2 ) const (Windows only)

HTuple HXLDCont.DistanceCcMinPoints( HXLDCont contour2, HTuple mode, out HTuple row1, out HTuple column1, out HTuple row2, out HTuple column2 )

double HXLDCont.DistanceCcMinPoints( HXLDCont contour2, string mode, out double row1, out double column1, out double row2, out double column2 )

Description🔗

distance_cc_min_pointsDistanceCcMinPoints calculates the minimum distance between Contour1contour1contour_1 and Contour2contour2contour_2. The minimum distance is returned in DistanceMindistanceMindistance_min. In comparison to distance_cc_minDistanceCcMin, this operator also returns the points on the contours that provide the minimum distance. The point on Contour1contour1contour_1 is returned in Row1row1row_1 and Column1column1column_1; the point on Contour2contour2contour_2 is returned in Row2row2row_2 and Column2column2column_2.

The parameter Modemodemode sets the type of computing the distance. 'fast_point_to_segment'"fast_point_to_segment" calculates the distance between the line segments adjacent to the closest contour points, and 'point_to_segment'"point_to_segment" determines the actual minimum distance between the contour segments.

While 'fast_point_to_segment'"fast_point_to_segment" is an efficient algorithm with a complexity of n*log(n), 'point_to_segment'"point_to_segment" has quadratic complexity and thus takes a longer time to execute, especially for contours with many line segments.

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🔗

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🔗

Contour1contour1contour_1 (input_object) xld_cont(-array) → objectobjectHObjectHXLDContHObjectHobject

First input contour.

Contour2contour2contour_2 (input_object) xld_cont(-array) → objectobjectHObjectHXLDContHObjectHobject

Second input contour.

Modemodemode (input_control) string(-array) → (string)(string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Distance calculation mode.

Default: 'fast_point_to_segment'"fast_point_to_segment"
List of values: 'fast_point_to_segment', 'point_to_segment'"fast_point_to_segment", "point_to_segment"

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

Minimum distance between the two contours.

Row1row1row_1 (output_control) point.y(-array) → (real)(real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Row coordinate of the point on Contour1contour1contour_1.

Column1column1column_1 (output_control) point.x(-array) → (real)(real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Column coordinate of the point on Contour1contour1contour_1.

Row2row2row_2 (output_control) point.y(-array) → (real)(real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Row coordinate of the point on Contour2contour2contour_2.

Column2column2column_2 (output_control) point.x(-array) → (real)(real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Column coordinate of the point on Contour2contour2contour_2.

Example🔗

(C)

gen_contour_polygon_rounded_xld(Cont1, [0,100,100,0,0], [0,0,100,100,0],
                                [50,50,50,50,50], 0.5)\;
gen_contour_polygon_rounded_xld(Cont2, [41,91,91,41,41], [41,41,91,91,41],
                                [25,25,25,25,25], 0.5)\;
distance_cc_min_points(Cont1, Cont2, "fast_point_to_segment", &distance_min,
                       &Row1, &Column1, &Row2, &Column2)\;

Result🔗

distance_cc_min_pointsDistanceCcMinPoints returns 2 (H_MSG_TRUE).

Combinations with other operators🔗

Combinations

Alternatives

distance_scDistanceSc, distance_pcDistancePc, distance_ccDistanceCc, distance_contours_xldDistanceContoursXld, distance_cc_minDistanceCcMin

See also

distance_srDistanceSr, distance_prDistancePr

Module🔗

Foundation