Fixed bug computing min / max of X and Y axes when rescaling

The previous method would fail in some cases, e.g. if the second to last node in the array had (x, y) = (5, 0), and the last node had (x, y) = (10, 100), then yMin would be 100 instead of 0.