12.4.7 Find the barycenter of a set of points in space: barycenter
See section 11.6.9 for barycenters of objects in
the plane.
The barycenter command returns and draws the barycenter of a set of
weighted points. If the sum of the weights is zero, then this command
returns an error.
The points and their weights (real numbers) can be
given in two different ways.
-
A sequence of lists of length two.
The first element of each list is a point and the second element is
the weight of the point.
- A matrix with two columns.
The first column of the matrix contains the points and the
second column contains the corresponding weights.
Input:
BC := barycenter([point(1,4,0),1],[point(1,-2,0),1])
or:
BC := barycenter([[point(1,4,0),1],[point(1,-2,0),1]])
then:
coordinates(BC)
Output:
[1,1,0]