Origin calculation fix
Fixed calculation of origin coordinate, added function to recalculate origin and update position if the origin changes
Fixed calculation of origin coordinate, added function to recalculate origin and update position if the origin changes