centroid_points

compas.geometry.centroid_points(points)[source]

Compute the centroid of a set of points.

Parameters

points (sequence[[float, float, float] | Point]) – A sequence of XYZ coordinates.

Returns

[float, float, float] – XYZ coordinates of the centroid.

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(points)
[0.5, 0.5, 0.0]