Fix rounding error of calculating shortest distance
Fix rounding error of calculating shortest distance

It's dividing the distance by a million here to make it count less in the score, compared to measures of angles and such. However the order of operations here was:
1. divide coord_t-distance by 1M
2. auto-convert the result to float
In the division in step 1 it was still coord_t (integer) so this ends up rounding down in groups of 1 million units (up to 1mm of actual distance). So the fix is to reverse these operations. First cast to float, then divide by 1 million. This results in a float that doesn't need to be cast again. There will be less rounding errors since floats can represent fractional numbers.

Fixes CURA-8090.

Ultimaker/CuraEngine,Ultimaker/CuraEngine