area_center_xld — Area and center of gravity (centroid) of contours and polygons.
area_center_xld calculates the area and center of gravity
(centroid) of the regions enclosed by the contours or polygons
XLD as well as the order of the points along the
boundary. The area and centroid are computed by applying Green's
theorem using only the points on the contour or polygon, i.e., no
region is generated explicitly for the purpose of calculating the
features. If the points are arranged counterclockwise (i.e., in a
positive mathematical sense) in the contour or polygon,
will be 'positive'. It is assumed that the contours or
polygons are closed. If this is not the case
area_center_xld will artificially close the contour respectively
It should be noted that
area_center_xld only returns useful
results if the contour or polygon encloses a region in the plane. In
particular, the contour or polygon must not intersect itself. This
is particularly important if open contours or polygons are passed
because they are closed automatically, which can produce a
self-intersection. To test whether the contours or polygons
test_self_intersection_xld can be
used. If the contour or polygon intersects itself, a useful value
for the center of gravity can be calculated with
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
Contours or polygons to be examined.
Area enclosed by the contour or polygon.
Row coordinate of the centroid.
Column coordinate of the centroid.
point order along the boundary ('positive'/'negative').
Let n be the number of points of the contour or polygon. Then the run time is O(n).
area_center_xld returns 2 (H_MSG_TRUE) if the input is not empty.
If the input is empty the behavior can be set via
necessary, an exception is raised.