centroid_points_xy

compas.geometry.centroid_points_xy(points)[source]

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

Warning

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

Parameters

points (list of list) – A sequence of points represented by their XY(Z) coordinates.

Returns

list – XYZ coordinates of the centroid (Z = 0.0).

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]