Center of Gravity

Given n points defining a polygon it calculates the center of mass.


In [1]:
%pylab inline


Populating the interactive namespace from numpy and matplotlib

In [2]:
import mathlab

importing the Math and Physics Lab project

To Do: write equations/comments/


In [3]:
points = [[0,0], [8,1], [3,3], [1,8], [0,0]]
mathlab.gravity_center(points)


x[] [0, 8, 3, 1, 0]
y[] [0, 1, 3, 8, 0]
area[]: [0.0, 10.5, 10.5, 0.0]
total area:  21.0

In [ ]: