2013/8/20 mathog <mathog@...1176...>:
p0[X] = Inkscape::px_to_in(pO[X]);
That is at least unambiguous in regards to the conversion being performed, but it is still no improvement over the older:
p0[X] *= IN_PER_PX;
In the former case, the statement reads naturally from left to right: p0[X] is converted from pixels to inches. In the latter, you need t think a few second about what is being performed.
However, that's still not perfect, because in the former example, 'px' is visually nearer to the quantity that's actually expressed in inches after this call. So possibly the best way to write this would be:
p0[X] = inches_from_pixels(p0[X]);
then it seems that whatever else 12471 implements, coordinates are still dimensionless. So all of this mucking around with syntax is in the end still only specifying a single multiplicative factor, albeit one that maybe now can be changed while the program is running.
True, that seems to be the case. However, even if the situation only improved a little, removing 3 different unit definitions is still a good thing. Changing the 'convert' calls to something more readable should be possible simply by running grep + sed over the source.
Regards, Krzysztof