area_center_points_xldarea_center_points_xldAreaCenterPointsXldAreaCenterPointsXldarea_center_points_xld (算子名称)
名称
area_center_points_xldarea_center_points_xldAreaCenterPointsXldAreaCenterPointsXldarea_center_points_xld
— Area and center of gravity (centroid) of contours and polygons
treated as point clouds.
参数签名
Herror area_center_points_xld(const Hobject XLD, double* Area, double* Row, double* Column)
Herror T_area_center_points_xld(const Hobject XLD, Htuple* Area, Htuple* Row, Htuple* Column)
def area_center_points_xld(xld: HObject) -> Tuple[Sequence[float], Sequence[float], Sequence[float]]
def area_center_points_xld_s(xld: HObject) -> Tuple[float, float, float]
描述
area_center_points_xldarea_center_points_xldAreaCenterPointsXldAreaCenterPointsXldAreaCenterPointsXldarea_center_points_xld
calculates the area and center of
gravity (centroid) of the point clouds given by contours or polygons
XLDXLDXLDXLDXLDxld
(i.e., the order of the points in the contour or
polygon is not taken into account). The area corresponds to the
number of points in the point cloud. The centroid is given by the
arithmetic mean of all 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.
area_center_points_xldarea_center_points_xldAreaCenterPointsXldAreaCenterPointsXldAreaCenterPointsXldarea_center_points_xld
should be used if the contour XLDXLDXLDXLDXLDxld
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
area_center_xldarea_center_xldAreaCenterXldAreaCenterXldAreaCenterXldarea_center_xld
does not produce useful results. To test whether the
contours or polygons intersect themselves,
test_self_intersection_xldtest_self_intersection_xldTestSelfIntersectionXldTestSelfIntersectionXldTestSelfIntersectionXldtest_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
XLDXLDXLDXLDXLDxld
.
注意
Even if the contour or polygon XLDXLDXLDXLDXLDxld
is not intersecting itself, the
result of area_center_points_xldarea_center_points_xldAreaCenterPointsXldAreaCenterPointsXldAreaCenterPointsXldarea_center_points_xld
significantly differs from the
result of area_center_xldarea_center_xldAreaCenterXldAreaCenterXldAreaCenterXldarea_center_xld
as it is calculated from the point cloud
and not from the enclosed region.
运行信息
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Automatically parallelized on tuple level.
参数表
XLDXLDXLDXLDXLDxld
(input_object) xld(-array) →
objectHXLDHObjectHXLDHobject
Point clouds to be examined in form of contours or
polygons.
AreaAreaAreaAreaareaarea
(output_control) real(-array) →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Area of the point cloud.
RowRowRowRowrowrow
(output_control) point.y(-array) →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Row coordinate of the centroid.
ColumnColumnColumnColumncolumncolumn
(output_control) point.x(-array) →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Column coordinate of the centroid.
Complexity
Let n be the number of points of the contour or polygon.
Then the run time is O(n).
结果
area_center_points_xldarea_center_points_xldAreaCenterPointsXldAreaCenterPointsXldAreaCenterPointsXldarea_center_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.
可能的前置算子
gen_contours_skeleton_xldgen_contours_skeleton_xldGenContoursSkeletonXldGenContoursSkeletonXldGenContoursSkeletonXldgen_contours_skeleton_xld
,
smooth_contours_xldsmooth_contours_xldSmoothContoursXldSmoothContoursXldSmoothContoursXldsmooth_contours_xld
,
gen_polygons_xldgen_polygons_xldGenPolygonsXldGenPolygonsXldGenPolygonsXldgen_polygons_xld
可替代算子
area_center_xldarea_center_xldAreaCenterXldAreaCenterXldAreaCenterXldarea_center_xld
参考其它
moments_points_xldmoments_points_xldMomentsPointsXldMomentsPointsXldMomentsPointsXldmoments_points_xld
,
moments_any_points_xldmoments_any_points_xldMomentsAnyPointsXldMomentsAnyPointsXldMomentsAnyPointsXldmoments_any_points_xld
,
area_centerarea_centerAreaCenterAreaCenterAreaCenterarea_center
,
moments_region_2ndmoments_region_2ndMomentsRegion2ndMomentsRegion2ndMomentsRegion2ndmoments_region_2nd
模块
Foundation