distance_cc_min_pointsdistance_cc_min_pointsDistanceCcMinPointsDistanceCcMinPointsdistance_cc_min_points (Operator)
Name
distance_cc_min_pointsdistance_cc_min_pointsDistanceCcMinPointsDistanceCcMinPointsdistance_cc_min_points
— Calculate the minimum distance between two contours and the points used for
the calculation.
Signature
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)
void DistanceCcMinPoints(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)
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)
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)
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]
Description
distance_cc_min_pointsdistance_cc_min_pointsDistanceCcMinPointsDistanceCcMinPointsdistance_cc_min_points
calculates the minimum distance between
Contour1Contour1Contour1contour1contour_1
and Contour2Contour2Contour2contour2contour_2
.
The minimum distance is returned in DistanceMinDistanceMinDistanceMindistanceMindistance_min
.
In comparison to distance_cc_mindistance_cc_minDistanceCcMinDistanceCcMindistance_cc_min
, this operator also returns the
points on the contours that provide the minimum distance.
The point on Contour1Contour1Contour1contour1contour_1
is returned in Row1Row1Row1row1row_1
and
Column1Column1Column1column1column_1
; the point on Contour2Contour2Contour2contour2contour_2
is returned in
Row2Row2Row2row2row_2
and Column2Column2Column2column2column_2
.
The parameter ModeModeModemodemode
sets the type of computing the distance.
'fast_point_to_segment'"fast_point_to_segment""fast_point_to_segment""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""point_to_segment""point_to_segment""point_to_segment" determines the actual minimum distance between
the contour segments.
While 'fast_point_to_segment'"fast_point_to_segment""fast_point_to_segment""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""point_to_segment""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
- 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
Contour1Contour1Contour1contour1contour_1
(input_object) xld_cont(-array) →
objectHXLDContHObjectHObjectHobject
First input contour.
Contour2Contour2Contour2contour2contour_2
(input_object) xld_cont(-array) →
objectHXLDContHObjectHObjectHobject
Second input contour.
ModeModeModemodemode
(input_control) string(-array) →
HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Distance calculation mode.
Default:
'fast_point_to_segment'
"fast_point_to_segment"
"fast_point_to_segment"
"fast_point_to_segment"
"fast_point_to_segment"
List of values:
'fast_point_to_segment'"fast_point_to_segment""fast_point_to_segment""fast_point_to_segment""fast_point_to_segment", 'point_to_segment'"point_to_segment""point_to_segment""point_to_segment""point_to_segment"
DistanceMinDistanceMinDistanceMindistanceMindistance_min
(output_control) number(-array) →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Minimum distance between the two 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_min_points(Cont1, Cont2, "fast_point_to_segment", &distance_min,
&Row1, &Column1, &Row2, &Column2);
Result
distance_cc_min_pointsdistance_cc_min_pointsDistanceCcMinPointsDistanceCcMinPointsdistance_cc_min_points
returns 2 (
H_MSG_TRUE)
.
Alternatives
distance_scdistance_scDistanceScDistanceScdistance_sc
,
distance_pcdistance_pcDistancePcDistancePcdistance_pc
,
distance_ccdistance_ccDistanceCcDistanceCcdistance_cc
,
distance_contours_xlddistance_contours_xldDistanceContoursXldDistanceContoursXlddistance_contours_xld
,
distance_cc_mindistance_cc_minDistanceCcMinDistanceCcMindistance_cc_min
See also
distance_srdistance_srDistanceSrDistanceSrdistance_sr
,
distance_prdistance_prDistancePrDistancePrdistance_pr
Module
Foundation