moments_points_xld moments_points_xld MomentsPointsXld MomentsPointsXld moments_points_xld (Operator)
Name
moments_points_xld moments_points_xld MomentsPointsXld MomentsPointsXld moments_points_xld
— Geometric moments
,
, and
of contours or polygons treated as point clouds.
Signature
Herror moments_points_xld (const Hobject XLD , double* M11 , double* M20 , double* M02 )
Herror T_moments_points_xld (const Hobject XLD , Htuple* M11 , Htuple* M20 , Htuple* M02 )
void MomentsPointsXld (const HObject& XLD , HTuple* M11 , HTuple* M20 , HTuple* M02 )
HTuple HXLD ::MomentsPointsXld (HTuple* M20 , HTuple* M02 ) const
double HXLD ::MomentsPointsXld (double* M20 , double* M02 ) const
def moments_points_xld (xld : HObject) -> Tuple[Sequence[float], Sequence[float], Sequence[float]]
def moments_points_xld_s (xld : HObject) -> Tuple[float, float, float]
Description
moments_points_xld moments_points_xld MomentsPointsXld MomentsPointsXld MomentsPointsXld moments_points_xld
calculates the moments (M20 M20 M20 M20 m20 m20
,
M02 M02 M02 M02 m02 m02
, and M11 M11 M11 M11 m11 m11
) of a point cloud given by a contour or a
polygon XLD XLD XLD XLD XLD xld
(i.e., the order of the points in the contour or
polygon is not taken into account). Therefore, the moments are given by
Here,
is the centroid and
n the number of points.
If the contour or polygon is closed
(end point = start point), the end point of the contour or polygon is
not taken into account to avoid that it receives twice the weight of
the other points.
moments_points_xld moments_points_xld MomentsPointsXld MomentsPointsXld MomentsPointsXld moments_points_xld
should be used if the contour XLD XLD XLD XLD XLD xld
intersects itself or if it is not possible to close the contour using a line
from end to start point without self-intersection, because in this case
moments_xld moments_xld MomentsXld MomentsXld MomentsXld moments_xld
does not produce useful results. To test whether the
contours or polygons intersect themselves,
test_self_intersection_xld test_self_intersection_xld TestSelfIntersectionXld TestSelfIntersectionXld TestSelfIntersectionXld test_self_intersection_xld
can be used.
If more than one contour or polygon is passed, the results are stored
in tuples in the same order as the respective contours or polygons in
XLD XLD XLD XLD XLD xld
.
Execution Information
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
Multithreading scope: global (may be called from any thread).
Automatically parallelized on tuple level.
Parameters
XLD XLD XLD XLD XLD xld
(input_object) xld(-array) →
object HXLD HObject HXLD Hobject
Contours or polygons to be examined.
M11 M11 M11 M11 m11 m11
(output_control) real(-array) →
HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Mixed second order moment.
M20 M20 M20 M20 m20 m20
(output_control) real(-array) →
HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Second order moment along the row axis.
M02 M02 M02 M02 m02 m02
(output_control) real(-array) →
HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Second order moment along the column axis.
Complexity
Let n be the number of points of the contour or polygon.
Then the run time is O(n).
Result
moments_points_xld moments_points_xld MomentsPointsXld MomentsPointsXld MomentsPointsXld moments_points_xld
returns 2 (H_MSG_TRUE) if the input is not
empty. If the input is empty the behavior can be set via
set_system(::'no_object_result',<Result>:) set_system("no_object_result",<Result>) SetSystem("no_object_result",<Result>) SetSystem("no_object_result",<Result>) SetSystem("no_object_result",<Result>) set_system("no_object_result",<Result>)
. If necessary,
an exception is raised.
Possible Predecessors
gen_contours_skeleton_xld gen_contours_skeleton_xld GenContoursSkeletonXld GenContoursSkeletonXld GenContoursSkeletonXld gen_contours_skeleton_xld
,
smooth_contours_xld smooth_contours_xld SmoothContoursXld SmoothContoursXld SmoothContoursXld smooth_contours_xld
,
gen_polygons_xld gen_polygons_xld GenPolygonsXld GenPolygonsXld GenPolygonsXld gen_polygons_xld
Alternatives
moments_xld moments_xld MomentsXld MomentsXld MomentsXld moments_xld
,
moments_any_xld moments_any_xld MomentsAnyXld MomentsAnyXld MomentsAnyXld moments_any_xld
,
moments_any_points_xld moments_any_points_xld MomentsAnyPointsXld MomentsAnyPointsXld MomentsAnyPointsXld moments_any_points_xld
See also
moments_any_points_xld moments_any_points_xld MomentsAnyPointsXld MomentsAnyPointsXld MomentsAnyPointsXld moments_any_points_xld
,
area_center_points_xld area_center_points_xld AreaCenterPointsXld AreaCenterPointsXld AreaCenterPointsXld area_center_points_xld
,
moments_region_2nd moments_region_2nd MomentsRegion2nd MomentsRegion2nd MomentsRegion2nd moments_region_2nd
,
area_center area_center AreaCenter AreaCenter AreaCenter area_center
Module
Foundation