centroid_points_xy

compas.geometry.centroid_points_xy(points)[source]

Compute the centroid of a set of points lying in the XY-plane.

Parameters

points (sequence[[float, float] or [float, float, float] | compas.geometry.Point]) – A sequence of points represented by their XY(Z) coordinates.

Returns

[float, float, 0.0] – XYZ coordinates of the centroid in the XY plane.

Warning

Duplicate points are NOT removed. If there are duplicates in the sequence, they should be there intentionally.

Examples

>>> points = [[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [1.0, 1.0, 0.0], [0.0, 1.0, 0.0]]
>>> centroid_points_xy(points)
[0.5, 0.5, 0.0]