calculate relative position & scale ratio