Skip to content

distance_contours_xlddistance_contours_xldDistanceContoursXldDistanceContoursXlddistance_contours_xlddistance_contours_xldπŸ”—

Short descriptionπŸ”—

distance_contours_xlddistance_contours_xldDistanceContoursXldDistanceContoursXlddistance_contours_xlddistance_contours_xld β€” Calculate the pointwise distance from one contour to another.

SignatureπŸ”—

distance_contours_xld( xld_cont ContourFrom, xld_cont ContourTo, out xld_cont ContourOut, string Mode )distance_contours_xld( ContourFrom, ContourTo : ContourOut : Mode : )void DistanceContoursXld( const HObject& ContourFrom, const HObject& ContourTo, HObject* ContourOut, const HTuple& Mode )static void HOperatorSet.DistanceContoursXld( HObject contourFrom, HObject contourTo, out HObject contourOut, HTuple mode )def distance_contours_xld( contour_from: HObject, contour_to: HObject, mode: str ) -> HObject

Herror distance_contours_xld( const Hobject ContourFrom, const Hobject ContourTo, Hobject* ContourOut, const char* Mode )

Herror T_distance_contours_xld( const Hobject ContourFrom, const Hobject ContourTo, Hobject* ContourOut, const Htuple Mode )

HXLDCont HXLDCont::DistanceContoursXld( const HXLDCont& ContourTo, const HString& Mode ) const

HXLDCont HXLDCont::DistanceContoursXld( const HXLDCont& ContourTo, const char* Mode ) const

HXLDCont HXLDCont::DistanceContoursXld( const HXLDCont& ContourTo, const wchar_t* Mode ) const (Windows only)

HXLDCont HXLDCont.DistanceContoursXld( HXLDCont contourTo, string mode )

DescriptionπŸ”—

The operator distance_contours_xldDistanceContoursXld calculates for each point in ContourFromcontourFromcontour_from the minimal distance to the contours in ContourTocontourTocontour_to. The operator returns the contour ContourOutcontourOutcontour_out which consists of ContourFromcontourFromcontour_from containing the computed distances in the attribute 'distance'"distance". The distances can be accessed by querying the attribute 'distance'"distance" with the operator get_contour_attrib_xldGetContourAttribXld. See the operator reference of get_contour_attrib_xldGetContourAttribXld for further information about contour attributes.

The parameter Modemodemode determines which distances are calculated for each point in ContourFromcontourFromcontour_from: 'point_to_point'"point_to_point" calculates the minimal distance to the base points of ContourTocontourTocontour_to. In contrast, 'point_to_segment'"point_to_segment" calculates the minimum distance to the contour segments in ContourTocontourTocontour_to (see the figure below).

The dashed lines illustrate the calculated distances starting from a point of ContourFromcontourFromcontour_from on the left. The distance \(d_{1}\) corresponds to the 'point_to_point'"point_to_point" mode, whereas the distance \(d_{2}\) corresponds to the 'point_to_segment'"point_to_segment" mode.

Note that in many applications the mode 'point_to_segment'"point_to_segment" suggests itself for an accurate result, whereas 'point_to_point'"point_to_point" is considerably faster. If m is the number of points in ContourFromcontourFromcontour_from, and n the number of points in ContourTocontourTocontour_to, then distance_contours_xldDistanceContoursXld has complexity O(mlog(n)) for 'point_to_point'"point_to_point", and O(mn) for 'point_to_segment'"point_to_segment". In case the template contour ContourTocontourTocontour_to is repeatedly used, the operators create_distance_transform_xldCreateDistanceTransformXld and apply_distance_transform_xldApplyDistanceTransformXld can be used as an alternative to distance_contours_xldDistanceContoursXld. For further details, please refer to the documentation of create_distance_transform_xldCreateDistanceTransformXld.

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πŸ”—

ContourFromcontourFromcontour_from (input_object) xld_cont(-array) β†’ objectobjectHObjectHXLDContHObjectHobject

Contours for whose points the distances are calculated.

ContourTocontourTocontour_to (input_object) xld_cont(-array) β†’ objectobjectHObjectHXLDContHObjectHobject

Contours to which the distances are calculated to.

ContourOutcontourOutcontour_out (output_object) xld_cont(-array) β†’ objectobjectHObjectHXLDContHObjectHobject *

Copy of ContourFromcontourFromcontour_from containing the distances as an attribute.

Modemodemode (input_control) string β†’ (string)(string)HTuple (HString)HTuple (string)strHtuple (char*)

Compute the distance to points (β€˜point_to_point’) or to entire segments (β€˜point_to_segment’).

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

ResultπŸ”—

If all parameters are correct, the operator returns the value 2 (H_MSG_TRUE). Otherwise, an exception is raised.

Combinations with other operatorsπŸ”—

Combinations

Possible successors

get_contour_attrib_xldGetContourAttribXld, segment_contour_attrib_xldSegmentContourAttribXld

Alternatives

apply_distance_transform_xldApplyDistanceTransformXld, distance_ccDistanceCc, distance_cc_minDistanceCcMin

ModuleπŸ”—

Foundation