@bravekiwi Yes, this is a really clever trick! You can think of it by first drawing three triangles based on the original path through the rectangle.


Then we can reflect the green triangle and shift it down by one, and shift the purple triangle down twice so that they span a grid that is three times as tall:


The diagonal line here isn't necessarily a straight one; it happens to look like that because the green line looks like it's almost symmetric. In general, only the shortest path would give a straight line, because that would minimize the distance from start to finish. 🙂