Function File: cm = masscenter (pp)
Center of mass of a plane shape.
The shape is defined with piecewise smooth polynomials. pp is a cell where each elements is a 2-by-(poly_degree+1) matrix containing
px(i,:) = pp{i}(1,:)
andpy(i,:) = pp{i}(2,:)
.See also: inertiamoment
The following code
% non-convex bezier shape weirdhearth ={[34.81947,-63.60585 41.35964,1.61093; ... 73.22086,4.95439 7.1796,-34.7948]; ... [30.26599,-50.0316 77.6279,8.52058; ... -18.66371,58.02699 -168.20415,52.74819]}; CoM = masscenter (weirdhearth)
Produces the following output
warning: Shape has negative area. Assuming this is due to a clockwise parametrization of the boundary CoM = 19.170 38.767