calculate scale