distance_ccdistance_ccDistanceCcDistanceCcdistance_cc (Operator)

Name

distance_ccdistance_ccDistanceCcDistanceCcdistance_cc — Calculate the distance between two contours.

Signature

distance_cc(Contour1, Contour2 : : Mode : DistanceMin, DistanceMax)

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 DistanceCc(const HObject& Contour1, const HObject& Contour2, const HTuple& Mode, HTuple* DistanceMin, HTuple* DistanceMax)

void HXLDCont::DistanceCc(const HXLDCont& Contour2, const HString& 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)

static void HOperatorSet.DistanceCc(HObject contour1, HObject contour2, HTuple mode, out HTuple distanceMin, out HTuple distanceMax)

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

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

def distance_cc(contour_1: HObject, contour_2: HObject, mode: str) -> Tuple[Sequence[float], Sequence[float]]

def distance_cc_s(contour_1: HObject, contour_2: HObject, mode: str) -> Tuple[float, float]

Description

The operator distance_ccdistance_ccDistanceCcDistanceCcDistanceCcdistance_cc calculates the minimum and maximum distance between the base points of two contours ( Contour1Contour1Contour1Contour1contour1contour_1 and Contour2Contour2Contour2Contour2contour2contour_2). The parameters DistanceMinDistanceMinDistanceMinDistanceMindistanceMindistance_min and DistanceMaxDistanceMaxDistanceMaxDistanceMaxdistanceMaxdistance_max contain the resulting distance.

The parameter ModeModeModeModemodemode sets the type of computing the distance: 'point_to_point'"point_to_point""point_to_point""point_to_point""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""point_to_segment""point_to_segment""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 (n*n). If only the minimum distance is required, the operator distance_cc_mindistance_cc_minDistanceCcMinDistanceCcMinDistanceCcMindistance_cc_min can be used alternatively since it offers algorithms with a complexity of 'n*log(n)'"n*log(n)""n*log(n)""n*log(n)""n*log(n)""n*log(n)".

Attention

Both iconic input parameters must contain the same number of contours.

Execution Information

Parameters

Contour1Contour1Contour1Contour1contour1contour_1 (input_object)  xld_cont(-array) objectHXLDContHObjectHXLDContHobject

First input contour.

Contour2Contour2Contour2Contour2contour2contour_2 (input_object)  xld_cont(-array) objectHXLDContHObjectHXLDContHobject

Second input contour.

ModeModeModeModemodemode (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Distance calculation mode.

Default value: 'point_to_point' "point_to_point" "point_to_point" "point_to_point" "point_to_point" "point_to_point"

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

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

Minimum distance between both contours.

DistanceMaxDistanceMaxDistanceMaxDistanceMaxdistanceMaxdistance_max (output_control)  real(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (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_ccdistance_ccDistanceCcDistanceCcDistanceCcdistance_cc returns TRUE.

Alternatives

distance_scdistance_scDistanceScDistanceScDistanceScdistance_sc, distance_pcdistance_pcDistancePcDistancePcDistancePcdistance_pc, distance_cc_mindistance_cc_minDistanceCcMinDistanceCcMinDistanceCcMindistance_cc_min, distance_contours_xlddistance_contours_xldDistanceContoursXldDistanceContoursXldDistanceContoursXlddistance_contours_xld

See also

distance_srdistance_srDistanceSrDistanceSrDistanceSrdistance_sr, distance_prdistance_prDistancePrDistancePrDistancePrdistance_pr

Module

Foundation