moving origin calculation