added gravity center calculation