distance_contours_xlddistance_contours_xldDistanceContoursXldDistanceContoursXld (Operator)
Name
distance_contours_xlddistance_contours_xldDistanceContoursXldDistanceContoursXld
— Calculate the pointwise distance from one contour to another.
Signature
Description
The operator distance_contours_xlddistance_contours_xldDistanceContoursXldDistanceContoursXldDistanceContoursXld
calculates for each point in
ContourFromContourFromContourFromContourFromcontourFrom
the minimal distance to the contours in
ContourToContourToContourToContourTocontourTo
.
The operator returns the contour ContourOutContourOutContourOutContourOutcontourOut
which consists of
ContourFromContourFromContourFromContourFromcontourFrom
containing the computed distances in the
attribute 'distance'"distance""distance""distance""distance".
The distances can be accessed by querying the attribute
'distance'"distance""distance""distance""distance" with the operator get_contour_attrib_xldget_contour_attrib_xldGetContourAttribXldGetContourAttribXldGetContourAttribXld
.
See the operator reference of get_contour_attrib_xldget_contour_attrib_xldGetContourAttribXldGetContourAttribXldGetContourAttribXld
for further
information about contour attributes.
The parameter
ModeModeModeModemode
determines which distances are calculated for each point
in ContourFromContourFromContourFromContourFromcontourFrom
:
'point_to_point'"point_to_point""point_to_point""point_to_point""point_to_point" calculates the minimal distance to the base
points of ContourToContourToContourToContourTocontourTo
.
In contrast, 'point_to_segment'"point_to_segment""point_to_segment""point_to_segment""point_to_segment" calculates the minimum
distance to the contour segments in ContourToContourToContourToContourTocontourTo
(see the figure
below).
Note that in many applications the mode '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" is considerably faster.
If m is the number of points in ContourFromContourFromContourFromContourFromcontourFrom
, and n the number
of points in ContourToContourToContourToContourTocontourTo
, then distance_contours_xlddistance_contours_xldDistanceContoursXldDistanceContoursXldDistanceContoursXld
has complexity O(mlog(n)) for '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".
In case the template contour ContourToContourToContourToContourTocontourTo
is repeatedly used, the
operators create_distance_transform_xldcreate_distance_transform_xldCreateDistanceTransformXldCreateDistanceTransformXldCreateDistanceTransformXld
and
apply_distance_transform_xldapply_distance_transform_xldApplyDistanceTransformXldApplyDistanceTransformXldApplyDistanceTransformXld
can be used as an alternative to
distance_contours_xlddistance_contours_xldDistanceContoursXldDistanceContoursXldDistanceContoursXld
. For further details, please refer to
the documentation of create_distance_transform_xldcreate_distance_transform_xldCreateDistanceTransformXldCreateDistanceTransformXldCreateDistanceTransformXld
.
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
ContourFromContourFromContourFromContourFromcontourFrom
(input_object) xld_cont(-array) →
objectHXLDContHXLDContHobject
Contours for whose points the distances are
calculated.
ContourToContourToContourToContourTocontourTo
(input_object) xld_cont(-array) →
objectHXLDContHXLDContHobject
Contours to which the distances are
calculated to.
ModeModeModeModemode
(input_control) string →
HTupleHTupleHtuple (string) (string) (HString) (char*)
Compute the distance to points ('point_to_point')
or to entire segments ('point_to_segment').
Default value:
'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_segment'"point_to_segment""point_to_segment""point_to_segment""point_to_segment"
Result
If all parameters are correct, the operator returns the
value 2 (H_MSG_TRUE). Otherwise, an exception is raised.
Possible Successors
get_contour_attrib_xldget_contour_attrib_xldGetContourAttribXldGetContourAttribXldGetContourAttribXld
,
segment_contour_attrib_xldsegment_contour_attrib_xldSegmentContourAttribXldSegmentContourAttribXldSegmentContourAttribXld
Alternatives
apply_distance_transform_xldapply_distance_transform_xldApplyDistanceTransformXldApplyDistanceTransformXldApplyDistanceTransformXld
,
distance_ccdistance_ccDistanceCcDistanceCcDistanceCc
,
distance_cc_mindistance_cc_minDistanceCcMinDistanceCcMinDistanceCcMin
Module
Foundation