distance_contours_xlddistance_contours_xldDistanceContoursXldDistanceContoursXlddistance_contours_xld (算子)

名称

distance_contours_xlddistance_contours_xldDistanceContoursXldDistanceContoursXlddistance_contours_xld — 计算从一个轮廓到另一个轮廓的逐点距离。

签名

distance_contours_xld(ContourFrom, ContourTo : ContourOut : Mode : )

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)

void DistanceContoursXld(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)

static void HOperatorSet.DistanceContoursXld(HObject contourFrom, HObject contourTo, out HObject contourOut, HTuple mode)

HXLDCont HXLDCont.DistanceContoursXld(HXLDCont contourTo, string mode)

def distance_contours_xld(contour_from: HObject, contour_to: HObject, mode: str) -> HObject

描述

算子 distance_contours_xlddistance_contours_xldDistanceContoursXldDistanceContoursXldDistanceContoursXlddistance_contours_xld calculates for each point in ContourFromContourFromContourFromContourFromcontourFromcontour_from the minimal distance to the contours in ContourToContourToContourToContourTocontourTocontour_to. The operator returns the contour ContourOutContourOutContourOutContourOutcontourOutcontour_out which consists of ContourFromContourFromContourFromContourFromcontourFromcontour_from containing the computed distances in the attribute 'distance'"distance""distance""distance""distance""distance". The distances can be accessed by querying the attribute 'distance'"distance""distance""distance""distance""distance" with the operator get_contour_attrib_xldget_contour_attrib_xldGetContourAttribXldGetContourAttribXldGetContourAttribXldget_contour_attrib_xld。See the operator reference of get_contour_attrib_xldget_contour_attrib_xldGetContourAttribXldGetContourAttribXldGetContourAttribXldget_contour_attrib_xld for further information about contour attributes.

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

The dashed lines illustrate the calculated distances starting from a point of ContourFromContourFromContourFromContourFromcontourFromcontour_from on the left. The distance corresponds to the 'point_to_point'"point_to_point""point_to_point""point_to_point""point_to_point""point_to_point" mode, whereas the distance corresponds to the 'point_to_segment'"point_to_segment""point_to_segment""point_to_segment""point_to_segment""point_to_segment" mode.

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

执行信息

参数

ContourFromContourFromContourFromContourFromcontourFromcontour_from (输入对象)  xld_cont(-array) objectHXLDContHObjectHXLDContHobject

Contours for whose points the distances are calculated.

ContourToContourToContourToContourTocontourTocontour_to (输入对象)  xld_cont(-array) objectHXLDContHObjectHXLDContHobject

Contours to which the distances are calculated to.

ContourOutContourOutContourOutContourOutcontourOutcontour_out (输出对象)  xld_cont(-array) objectHXLDContHObjectHXLDContHobject *

Copy of ContourFromContourFromContourFromContourFromcontourFromcontour_from containing the distances as an attribute.

ModeModeModeModemodemode (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Compute the distance to points ('point_to_point') or to entire segments ('point_to_segment').

默认值: 'point_to_point' "point_to_point" "point_to_point" "point_to_point" "point_to_point" "point_to_point"

值列表: '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"

结果

如果所有参数都正确,算子返回值 2 ( H_MSG_TRUE )。否则,将抛出异常。

可能的后继

get_contour_attrib_xldget_contour_attrib_xldGetContourAttribXldGetContourAttribXldGetContourAttribXldget_contour_attrib_xld, segment_contour_attrib_xldsegment_contour_attrib_xldSegmentContourAttribXldSegmentContourAttribXldSegmentContourAttribXldsegment_contour_attrib_xld

替代

apply_distance_transform_xldapply_distance_transform_xldApplyDistanceTransformXldApplyDistanceTransformXldApplyDistanceTransformXldapply_distance_transform_xld, distance_ccdistance_ccDistanceCcDistanceCcDistanceCcdistance_cc, distance_cc_mindistance_cc_minDistanceCcMinDistanceCcMinDistanceCcMindistance_cc_min

模块

基础