Skip to content

distance_ccDistanceCcDistanceCcdistance_ccdistance_cc🔗

Short description🔗

distance_ccDistanceCcDistanceCcdistance_ccdistance_cc — Calculate the distance between two contours.

Signature🔗

distance_cc( xld_cont Contour1, xld_cont Contour2, string Mode, out real DistanceMin, out real DistanceMax )void DistanceCc( const HObject& Contour1, const HObject& Contour2, const HTuple& Mode, HTuple* DistanceMin, HTuple* DistanceMax )static void HOperatorSet.DistanceCc( HObject contour1, HObject contour2, HTuple mode, out HTuple distanceMin, out HTuple distanceMax )def distance_cc( contour_1: HObject, contour_2: HObject, mode: MaybeSequence[str] ) -> Tuple[Sequence[float], Sequence[float]]

def distance_cc_s( contour_1: HObject, contour_2: HObject, mode: MaybeSequence[str] ) -> Tuple[float, float]Herror distance_cc( const Hobject Contour1, const Hobject Contour2, const char* Mode, double* DistanceMin, double* DistanceMax )

Herror T_distance_cc( const Hobject Contour1, const Hobject Contour2, const Htuple Mode, Htuple* DistanceMin, Htuple* DistanceMax )

void HXLDCont::DistanceCc( const HXLDCont& Contour2, const HTuple& Mode, HTuple* DistanceMin, HTuple* DistanceMax ) const

void HXLDCont::DistanceCc( const HXLDCont& Contour2, const HString& Mode, double* DistanceMin, double* DistanceMax ) const

void HXLDCont::DistanceCc( const HXLDCont& Contour2, const char* Mode, double* DistanceMin, double* DistanceMax ) const

void HXLDCont::DistanceCc( const HXLDCont& Contour2, const wchar_t* Mode, double* DistanceMin, double* DistanceMax ) const (Windows only)

void HXLDCont.DistanceCc( HXLDCont contour2, HTuple mode, out HTuple distanceMin, out HTuple distanceMax )

void HXLDCont.DistanceCc( HXLDCont contour2, string mode, out double distanceMin, out double distanceMax )

Description🔗

The operator distance_ccDistanceCc calculates the minimum and maximum distance between the base points of two contours (Contour1contour1contour_1 and Contour2contour2contour_2). The parameters DistanceMindistanceMindistance_min and DistanceMaxdistanceMaxdistance_max contain the resulting distance.

The parameter Modemodemode sets the type of computing the distance: 'point_to_point'"point_to_point" only determines the minimum and maximum distance between the base points of the contours. This results in faster algorithm, but may lead to inaccurate minimum distances. In contrast, 'point_to_segment'"point_to_segment" determines the actual minimum distance between the contour segments.

In both cases, the search algorithm has a quadratic complexity (nn). If only the minimum distance is required, the operator distance_cc_minDistanceCcMin can be used alternatively since it offers algorithms with a complexity of nlog(n).

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

  • Processed without parallelization.

Parameters🔗

Contour1contour1contour_1 (input_object) xld_cont(-array) → objectHObjectHXLDContHObjectHobject

First input contour.

Contour2contour2contour_2 (input_object) xld_cont(-array) → objectHObjectHXLDContHObjectHobject

Second input contour.

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

Distance calculation mode.

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

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

Minimum distance between both contours.

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

Maximum distance between both contours.

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(Cont1, Cont2, 'point_to_point', &distance_min, &distance_max)\;

Result🔗

distance_ccDistanceCc returns 2 (H_MSG_TRUE).

Combinations with other operators🔗

Combinations

Alternatives

distance_scDistanceSc, distance_pcDistancePc, distance_cc_minDistanceCcMin, distance_contours_xldDistanceContoursXld

See also

distance_srDistanceSr, distance_prDistancePr

Module🔗

Foundation