Skip to content

area_center_points_xldAreaCenterPointsXldAreaCenterPointsXldarea_center_points_xldarea_center_points_xld🔗

Short description🔗

area_center_points_xldAreaCenterPointsXldAreaCenterPointsXldarea_center_points_xldarea_center_points_xld — Area and center of gravity (centroid) of contours and polygons treated as point clouds.

Signature🔗

area_center_points_xld( xld XLD, out real Area, out point.y Row, out point.x Column )void AreaCenterPointsXld( const HObject& XLD, HTuple* Area, HTuple* Row, HTuple* Column )static void HOperatorSet.AreaCenterPointsXld( HObject XLD, out HTuple area, out HTuple row, out 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]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 )

HTuple HXLD::AreaCenterPointsXld( HTuple* Row, HTuple* Column ) const

double HXLD::AreaCenterPointsXld( double* Row, double* Column ) const

HTuple HXLD.AreaCenterPointsXld( out HTuple row, out HTuple column )

double HXLD.AreaCenterPointsXld( out double row, out double column )

Description🔗

area_center_points_xldAreaCenterPointsXld calculates the area and center of gravity (centroid) of the point clouds given by contours or polygons XLDXLDxld (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_xldAreaCenterPointsXld should be used if the contour XLDXLDxld 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_xldAreaCenterXld does not produce useful results. To test whether the contours or polygons intersect themselves, test_self_intersection_xldTestSelfIntersectionXld 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 XLDXLDxld.

Attention🔗

Even if the contour or polygon XLDXLDxld is not intersecting itself, the result of area_center_points_xldAreaCenterPointsXld significantly differs from the result of area_center_xldAreaCenterXld as it is calculated from the point cloud and not from the enclosed region.

Execution information🔗

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🔗

XLDXLDxld (input_object) xld(-array) → objectHObjectHXLDHObjectHobject

Point clouds to be examined in form of contours or polygons.

Areaareaarea (output_control) real(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Area of the point cloud.

Rowrowrow (output_control) point.y(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Row coordinate of the centroid.

Columncolumncolumn (output_control) point.x(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (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).

Result🔗

area_center_points_xldAreaCenterPointsXld 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>:). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

gen_contours_skeleton_xldGenContoursSkeletonXld, smooth_contours_xldSmoothContoursXld, gen_polygons_xldGenPolygonsXld

Alternatives

area_center_xldAreaCenterXld

See also

moments_points_xldMomentsPointsXld, moments_any_points_xldMomentsAnyPointsXld, area_centerAreaCenter, moments_region_2ndMomentsRegion2nd

Module🔗

Foundation