Perhaps it's over the top :wink:, but I've added quite a few more points (including intermediate 45 deg points) to see what happens with wrapping at each end.

And since we seem to be a gnat's whisker from merge, I've rebased & squashed.

Thanks.