I’m tired of typing and deciphering coordinates of the corners rectangles, and I’m wondering if anyone has found a better way.
A rectangle can simply be described by two lists x = {x1, y1}
and y = {x2, y2}
, but the coordinates of the corners quickly becomes the jumble {{x1, y1}, {x1, y2}, {x2, y2}, {x2, y1}}
(if the coordinates are listed clockwise). It gets worse for cubes and higher dimensions.
I’ve found one promising approach. This is to create two lists for the points on the different axes, x = {x1, x1, x2, x2}
and y = {y1, y2, y2, y1}
, and then combine them with Transpose@Join[{x},{y}]
. This approach extends to higher dimensions and also works for polygons, but it still requires the manual duplication of values.
One could write a function to do this in a black box, but I wonder if there a way to do elegantly and intuitively convert pairs of ranges into coordinates for rectangles?