new class added for calculating 2d object position