compas.geometry.centroid_points

compas.geometry.centroid_points(points)[source]

Compute the centroid of a set of points.

Warning

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

Parameters

points (sequence) – A sequence of XYZ coordinates.

Returns

list – XYZ coordinates of the centroid.

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]